gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

hook.go (1455B)


      1 package schema
      2 
      3 import (
      4 	"context"
      5 	"database/sql"
      6 	"reflect"
      7 )
      8 
      9 type Model interface {
     10 	ScanRows(ctx context.Context, rows *sql.Rows) (int, error)
     11 	Value() interface{}
     12 }
     13 
     14 type Query interface {
     15 	QueryAppender
     16 	Operation() string
     17 	GetModel() Model
     18 	GetTableName() string
     19 }
     20 
     21 //------------------------------------------------------------------------------
     22 
     23 type BeforeAppendModelHook interface {
     24 	BeforeAppendModel(ctx context.Context, query Query) error
     25 }
     26 
     27 var beforeAppendModelHookType = reflect.TypeOf((*BeforeAppendModelHook)(nil)).Elem()
     28 
     29 //------------------------------------------------------------------------------
     30 
     31 type BeforeScanHook interface {
     32 	BeforeScan(context.Context) error
     33 }
     34 
     35 var beforeScanHookType = reflect.TypeOf((*BeforeScanHook)(nil)).Elem()
     36 
     37 //------------------------------------------------------------------------------
     38 
     39 type AfterScanHook interface {
     40 	AfterScan(context.Context) error
     41 }
     42 
     43 var afterScanHookType = reflect.TypeOf((*AfterScanHook)(nil)).Elem()
     44 
     45 //------------------------------------------------------------------------------
     46 
     47 type BeforeScanRowHook interface {
     48 	BeforeScanRow(context.Context) error
     49 }
     50 
     51 var beforeScanRowHookType = reflect.TypeOf((*BeforeScanRowHook)(nil)).Elem()
     52 
     53 //------------------------------------------------------------------------------
     54 
     55 type AfterScanRowHook interface {
     56 	AfterScanRow(context.Context) error
     57 }
     58 
     59 var afterScanRowHookType = reflect.TypeOf((*AfterScanRowHook)(nil)).Elem()