Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDaoManager = NewManager()
DefaultDaoManager default dai manager. for default on app
View Source
var OperatorCodeMap = map[OperatorCode]string{ OprEq: string(OprEq), OprNe: string(OprNe), OprLte: string(OprLte), OprLt: string(OprLt), OprLike: string(OprLike), OprNotLike: string(OprNotLike), OprIsNot: string(OprIsNot), OprIs: string(OprIs), OprIn: string(OprIn), OprGte: string(OprGte), OprGt: string(OprGt), OprOr: string(OprOr)}
OperatorCodeMap key = OperatorCode , value = string
Functions ¶
func OpenTestMysqlDatabaseConnection ¶
OpenTestMysqlDatabaseConnection open mysql database connection
Types ¶
type GeneratorDefinition ¶
type GeneratorDefinition struct { //Generator generator single instance Generator StructGeneratorFunction //SliceGenerator generator slice ( pointer) SliceGenerator StructSliceGeneratorFunction }
GeneratorDefinition wrapper generator
type Manager ¶
type Manager interface { //RegisterModel register model to manager RegisterModel(instanceGenerators ...GeneratorDefinition) //FindByID find data by id FindByID(modelName string, IDstring string, DB *gorm.DB, logEntry *logrus.Entry) (result interface{}, err error) //List query for list of data List(modelName string, q query.Q, pageSize int32, page int32, DB *gorm.DB, baseLogEntry *logrus.Entry) (listData interface{}, count int64, err error) //GetColumnName membaca nama column actual. dari catalog membaca nama actual column //syaratnya model sudah di register. kalau model belum di register ini akan throw error GetColumnName(modelName string, name string) (dbColumnName string, err error) //GenerateDaoWithWhere generate where. so reference is ready to use for query ( i.e. for count, list etc) GenerateDaoWithWhere(modelName string, q query.Q, DB *gorm.DB, baseLogEntry *logrus.Entry) (dbWithWhere *gorm.DB, err error) //SimpleManager generate simple dao manager SimpleManager(DB *gorm.DB, baseLogEntry *logrus.Entry) SimpleDaoManager }
Manager dao manager interface
type OperatorCode ¶
type OperatorCode string
OperatorCode code for query operator. for parsing json param query
const ( //OprEq code for eq( = ) OprEq OperatorCode = "$eq" //OprGt code for gt( > ) OprGt OperatorCode = "$gt" //OprGte code for gte( >= ) OprGte OperatorCode = "$gte" //OprIn code for in OprIn OperatorCode = "$in" //OprIsNot code for is not OprIsNot OperatorCode = "$isNot" //OprIs code for is OprIs OperatorCode = "$is" //OprLike code for like OprLike OperatorCode = "$like" //OprNotLike parse parse operaator not like OprNotLike OperatorCode = "$notLike" //OprLt code for <( less then ) OprLt OperatorCode = "$lt" //OprLte code for <=( less then equals) OprLte OperatorCode = "$lte" //OprNe code for != ( not equals) OprNe OperatorCode = "$ne" //OprOr code for or OprOr OperatorCode = "$or" )
func (OperatorCode) StartWith ¶
func (p OperatorCode) StartWith(testedQuery string) (result bool)
StartWith check apah string start with code
type SimpleDaoManager ¶
type SimpleDaoManager interface { //FindByID find data by id FindByID(modelName string, IDstring string) (result interface{}, err error) //GenerateDaoWithWhere generate where. so reference is ready to use for query ( i.e. for count, list etc) GenerateDaoWithWhere(modelName string, q query.Q) (dbWithWhere *gorm.DB, err error) //List query for list of data List(modelName string, q query.Q, pageSize int32, page int32) (listData interface{}, count int64, err error) }
SimpleDaoManager dao manager with strip down param. db an log entry passes as member variable on struct
func NewSimpleManager ¶
NewSimpleManager generate new simple dao manager
type StructGeneratorFunction ¶
type StructGeneratorFunction func() (instance interface{})
StructGeneratorFunction generator struct
type StructSliceGeneratorFunction ¶
type StructSliceGeneratorFunction func() (instance interface{})
StructSliceGeneratorFunction generator slice for struct
Source Files ¶
Click to show internal directories.
Click to hide internal directories.