@@ -39,7 +39,7 @@ type Interface[T any] interface {
3939
4040type CreateInterface [T any ] interface {
4141 ExecInterface [T ]
42- // chain methods available at start; return ChainInterface
42+ // chain methods available at start; Select/Omit keep CreateInterface to allow Create chaining
4343 Scopes (scopes ... func (db * Statement )) ChainInterface [T ]
4444 Where (query interface {}, args ... interface {}) ChainInterface [T ]
4545 Not (query interface {}, args ... interface {}) ChainInterface [T ]
@@ -48,8 +48,8 @@ type CreateInterface[T any] interface {
4848 Offset (offset int ) ChainInterface [T ]
4949 Joins (query clause.JoinTarget , on func (db JoinBuilder , joinTable clause.Table , curTable clause.Table ) error ) ChainInterface [T ]
5050 Preload (association string , query func (db PreloadBuilder ) error ) ChainInterface [T ]
51- Select (query string , args ... interface {}) ChainInterface [T ]
52- Omit (columns ... string ) ChainInterface [T ]
51+ Select (query string , args ... interface {}) CreateInterface [T ]
52+ Omit (columns ... string ) CreateInterface [T ]
5353 MapColumns (m map [string ]string ) ChainInterface [T ]
5454 Distinct (args ... interface {}) ChainInterface [T ]
5555 Group (name string ) ChainInterface [T ]
@@ -203,6 +203,18 @@ func (c createG[T]) Table(name string, args ...interface{}) CreateInterface[T] {
203203 })}
204204}
205205
206+ func (c createG [T ]) Select (query string , args ... interface {}) CreateInterface [T ] {
207+ return createG [T ]{c .with (func (db * DB ) * DB {
208+ return db .Select (query , args ... )
209+ })}
210+ }
211+
212+ func (c createG [T ]) Omit (columns ... string ) CreateInterface [T ] {
213+ return createG [T ]{c .with (func (db * DB ) * DB {
214+ return db .Omit (columns ... )
215+ })}
216+ }
217+
206218func (c createG [T ]) Set (assignments ... clause.Assigner ) SetCreateOrUpdateInterface [T ] {
207219 return c .processSet (assignments ... )
208220}
0 commit comments