bun.go (1968B)
1 package bun 2 3 import ( 4 "context" 5 6 "github.com/uptrace/bun/internal" 7 "github.com/uptrace/bun/schema" 8 ) 9 10 type ( 11 Safe = schema.Safe 12 Ident = schema.Ident 13 14 NullTime = schema.NullTime 15 BaseModel = schema.BaseModel 16 Query = schema.Query 17 18 BeforeAppendModelHook = schema.BeforeAppendModelHook 19 20 BeforeScanRowHook = schema.BeforeScanRowHook 21 AfterScanRowHook = schema.AfterScanRowHook 22 23 // DEPRECATED. Use BeforeScanRowHook instead. 24 BeforeScanHook = schema.BeforeScanHook 25 // DEPRECATED. Use AfterScanRowHook instead. 26 AfterScanHook = schema.AfterScanHook 27 ) 28 29 type BeforeSelectHook interface { 30 BeforeSelect(ctx context.Context, query *SelectQuery) error 31 } 32 33 type AfterSelectHook interface { 34 AfterSelect(ctx context.Context, query *SelectQuery) error 35 } 36 37 type BeforeInsertHook interface { 38 BeforeInsert(ctx context.Context, query *InsertQuery) error 39 } 40 41 type AfterInsertHook interface { 42 AfterInsert(ctx context.Context, query *InsertQuery) error 43 } 44 45 type BeforeUpdateHook interface { 46 BeforeUpdate(ctx context.Context, query *UpdateQuery) error 47 } 48 49 type AfterUpdateHook interface { 50 AfterUpdate(ctx context.Context, query *UpdateQuery) error 51 } 52 53 type BeforeDeleteHook interface { 54 BeforeDelete(ctx context.Context, query *DeleteQuery) error 55 } 56 57 type AfterDeleteHook interface { 58 AfterDelete(ctx context.Context, query *DeleteQuery) error 59 } 60 61 type BeforeCreateTableHook interface { 62 BeforeCreateTable(ctx context.Context, query *CreateTableQuery) error 63 } 64 65 type AfterCreateTableHook interface { 66 AfterCreateTable(ctx context.Context, query *CreateTableQuery) error 67 } 68 69 type BeforeDropTableHook interface { 70 BeforeDropTable(ctx context.Context, query *DropTableQuery) error 71 } 72 73 type AfterDropTableHook interface { 74 AfterDropTable(ctx context.Context, query *DropTableQuery) error 75 } 76 77 // SetLogger overwriters default Bun logger. 78 func SetLogger(logger internal.Logging) { 79 internal.Logger = logger 80 } 81 82 func In(slice interface{}) schema.QueryAppender { 83 return schema.In(slice) 84 }