Documentation
¶
Index ¶
- Constants
- Variables
- func AppendMorphPivots(db *gorm.DB, pivots []PivotInterface) (err error)
- func AppendPivots(db *gorm.DB, pivots []PivotInterface) (err error)
- func AssociationRelationship(db *gorm.DB, conditions *map[string]interface{}, mdl interface{}, ...) *gorm.Association
- func ClearAssociations(db *gorm.DB, object ModelInterface, foreignKey string, pivot PivotInterface) error
- func ClearPivots(db *gorm.DB, pivot PivotInterface, byForeignKey bool, byJoinKey bool) (err error)
- func FormatJsonBArrayToWhereInSQL(fields string, arrayValues []string) (sqlWhere string)
- func GetAllList(db *gorm.DB, conditions *map[string]interface{}, items interface{}, ...) (err error)
- func GetFirst(db *gorm.DB, conditions *map[string]interface{}, model interface{}, ...) (err error)
- func GetModelFieldValues(model interface{}) (mapFields *object.HashMap, err error)
- func GetModelFields(model interface{}) (fields []string)
- func GetTableFullName(schema string, prefix string, tableName string) (fullName string)
- func InsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, models interface{}) error
- func IsPowerModelLoaded(mdl ModelInterface) bool
- func IsPowerPivotLoaded(mdl ModelInterface) bool
- func Paginate(page int, pageSize int) func(db *gorm.DB) *gorm.DB
- func SavePivot(db *gorm.DB, pivot PivotInterface) error
- func SelectMorphPivot(db *gorm.DB, pivot PivotInterface) (result *gorm.DB)
- func SelectMorphPivots(db *gorm.DB, pivot PivotInterface, byForeignKey bool, byJoinKey bool) (result *gorm.DB)
- func SelectPivot(db *gorm.DB, pivot PivotInterface) (result *gorm.DB)
- func SelectPivots(db *gorm.DB, pivot PivotInterface, byForeignKey bool, byJoinKey bool) (result *gorm.DB)
- func SyncMorphPivots(db *gorm.DB, pivots []PivotInterface) (err error)
- func SyncPivots(db *gorm.DB, pivots []PivotInterface) (err error)
- func UpdatePivot(db *gorm.DB, pivot PivotInterface) error
- func UpsertModelsOnUniqueID(db *gorm.DB, mdl interface{}, uniqueName string, models interface{}, ...) error
- func UpsertPivots(db *gorm.DB, uniqueName string, pivots []PivotInterface, ...) error
- func WhereAccountUUID(uuid string) func(db *gorm.DB) *gorm.DB
- func WhereCampaignUUID(uuid string) func(db *gorm.DB) *gorm.DB
- func WhereUUID(uuid string) func(db *gorm.DB) *gorm.DB
- type ModelInterface
- type Pagination
- func (p *Pagination) GetLimit() int
- func (p *Pagination) GetOffset() int
- func (p *Pagination) GetPage() int
- func (p *Pagination) GetSort() string
- func (p *Pagination) SetLimit(limit int) *Pagination
- func (p *Pagination) SetPage(page int) *Pagination
- func (p *Pagination) SetSort(sort string) *Pagination
- type PivotInterface
- type PowerCompactModel
- func (mdl *PowerCompactModel) GetForeignRefer() string
- func (mdl *PowerCompactModel) GetForeignReferValue() string
- func (mdl *PowerCompactModel) GetID() int32
- func (mdl *PowerCompactModel) GetPowerModel() ModelInterface
- func (mdl *PowerCompactModel) GetPrimaryKey() string
- func (mdl *PowerCompactModel) GetTableName(needFull bool) string
- func (mdl *PowerCompactModel) GetUUID() string
- type PowerModel
- func (mdl *PowerModel) GetForeignRefer() string
- func (mdl *PowerModel) GetForeignReferValue() string
- func (mdl *PowerModel) GetID() int32
- func (mdl *PowerModel) GetPowerModel() ModelInterface
- func (mdl *PowerModel) GetPrimaryKey() string
- func (mdl *PowerModel) GetTableName(needFull bool) string
- func (mdl *PowerModel) GetUUID() string
- type PowerOperationLog
- type PowerPivot
- func (mdl *PowerPivot) GetForeignKey() string
- func (mdl *PowerPivot) GetForeignRefer() string
- func (mdl *PowerPivot) GetForeignReferValue() string
- func (mdl *PowerPivot) GetForeignValue() string
- func (mdl *PowerPivot) GetID() int32
- func (mdl *PowerPivot) GetJoinKey() string
- func (mdl *PowerPivot) GetJoinValue() string
- func (mdl *PowerPivot) GetOwnerKey() string
- func (mdl *PowerPivot) GetOwnerValue() string
- func (mdl *PowerPivot) GetPivotComposedUniqueID() string
- func (mdl *PowerPivot) GetPowerModel() ModelInterface
- func (mdl *PowerPivot) GetPrimaryKey() string
- func (mdl *PowerPivot) GetTableName(needFull bool) string
- func (mdl *PowerPivot) GetUUID() string
Constants ¶
View Source
const APPROVAL_STATUS_APPROVED int8 = 3
View Source
const APPROVAL_STATUS_DRAFT int8 = 0
View Source
const APPROVAL_STATUS_PENDING int8 = 1
View Source
const APPROVAL_STATUS_REJECTED int8 = 4
View Source
const COMPACT_UNIQUE_ID = "id"
View Source
const MODEL_STATUS_ACTIVE int8 = 1
View Source
const MODEL_STATUS_CANCELED int8 = 2
View Source
const MODEL_STATUS_DRAFT int8 = 0
View Source
const MODEL_STATUS_INACTIVE int8 = 4
View Source
const MODEL_STATUS_PENDING int8 = 3
View Source
const OPERAION_LOG_UNIQUE_ID = COMPACT_UNIQUE_ID
View Source
const OPERATION_EVENT_CREATE = 1
View Source
const OPERATION_EVENT_DELETE = 3
View Source
const OPERATION_EVENT_UPDATE = 2
View Source
const OPERATION_RESULT_CANCEL = 3
View Source
const OPERATION_RESULT_FAILED = 2
View Source
const OPERATION_RESULT_SUCCESS = 1
View Source
const PAGE_DEFAULT_SIZE = 20
View Source
const TABLE_NAME_OPERATION_LOG = "power_operation_log"
View Source
const UNIQUE_ID = "uuid"
Variables ¶
View Source
var ArrayModelFields *object.HashMap = &object.HashMap{}
View Source
var TABLE_PREFIX string
Functions ¶
func AppendMorphPivots ¶
func AppendMorphPivots(db *gorm.DB, pivots []PivotInterface) (err error)
func AppendPivots ¶
func AppendPivots(db *gorm.DB, pivots []PivotInterface) (err error)
--------------------------------------------------------------------
func AssociationRelationship ¶
func AssociationRelationship(db *gorm.DB, conditions *map[string]interface{}, mdl interface{}, relationship string, withClauseAssociations bool) *gorm.Association
*
- Association Pivot
func ClearAssociations ¶
func ClearAssociations(db *gorm.DB, object ModelInterface, foreignKey string, pivot PivotInterface) error
func ClearPivots ¶
clear all pivots with foreign key and value
func FormatJsonBArrayToWhereInSQL ¶
---------------------------------------------------------------------------------------------------------------------
func GetAllList ¶
func GetModelFieldValues ¶
func GetModelFields ¶
func GetModelFields(model interface{}) (fields []string)
func GetTableFullName ¶
func InsertModelsOnUniqueID ¶
func IsPowerModelLoaded ¶
func IsPowerModelLoaded(mdl ModelInterface) bool
func IsPowerPivotLoaded ¶
func IsPowerPivotLoaded(mdl ModelInterface) bool
func SelectMorphPivot ¶
func SelectMorphPivot(db *gorm.DB, pivot PivotInterface) (result *gorm.DB)
select one pivot with foreign key and join key
func SelectMorphPivots ¶
func SelectMorphPivots(db *gorm.DB, pivot PivotInterface, byForeignKey bool, byJoinKey bool) (result *gorm.DB)
select many pivots with foreign key
func SelectPivot ¶
func SelectPivot(db *gorm.DB, pivot PivotInterface) (result *gorm.DB)
func SelectPivots ¶
func SyncMorphPivots ¶
func SyncMorphPivots(db *gorm.DB, pivots []PivotInterface) (err error)
func SyncPivots ¶
func SyncPivots(db *gorm.DB, pivots []PivotInterface) (err error)
func UpdatePivot ¶
func UpdatePivot(db *gorm.DB, pivot PivotInterface) error
func UpsertModelsOnUniqueID ¶
func UpsertPivots ¶
Types ¶
type ModelInterface ¶
type Pagination ¶
type Pagination struct {
Limit int `json:"limit"`
Page int `json:"page"`
Sort string `json:"sort"`
TotalRows int64 `json:"totalRows"`
TotalPages int `json:"totalPages"`
Data interface{} `json:"data"`
}
func NewPagination ¶
func NewPagination(page int, limit int, sort string) *Pagination
func (*Pagination) GetLimit ¶
func (p *Pagination) GetLimit() int
func (*Pagination) GetOffset ¶
func (p *Pagination) GetOffset() int
func (*Pagination) GetPage ¶
func (p *Pagination) GetPage() int
func (*Pagination) GetSort ¶
func (p *Pagination) GetSort() string
func (*Pagination) SetLimit ¶
func (p *Pagination) SetLimit(limit int) *Pagination
func (*Pagination) SetPage ¶
func (p *Pagination) SetPage(page int) *Pagination
func (*Pagination) SetSort ¶
func (p *Pagination) SetSort(sort string) *Pagination
type PivotInterface ¶
type PowerCompactModel ¶
type PowerCompactModel struct {
ID int32 `gorm:"primaryKey;autoIncrement:true;unique; column:id; ->;<-:create" json:"-"`
CreatedAt time.Time `gorm:"column:created_at; ->;<-:create " json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func NewPowerCompactModel ¶
func NewPowerCompactModel() *PowerCompactModel
func (*PowerCompactModel) GetForeignRefer ¶
func (mdl *PowerCompactModel) GetForeignRefer() string
func (*PowerCompactModel) GetForeignReferValue ¶
func (mdl *PowerCompactModel) GetForeignReferValue() string
func (*PowerCompactModel) GetID ¶
func (mdl *PowerCompactModel) GetID() int32
func (*PowerCompactModel) GetPowerModel ¶
func (mdl *PowerCompactModel) GetPowerModel() ModelInterface
func (*PowerCompactModel) GetPrimaryKey ¶
func (mdl *PowerCompactModel) GetPrimaryKey() string
func (*PowerCompactModel) GetTableName ¶
func (mdl *PowerCompactModel) GetTableName(needFull bool) string
func (*PowerCompactModel) GetUUID ¶
func (mdl *PowerCompactModel) GetUUID() string
type PowerModel ¶
type PowerModel struct {
ID int32 `gorm:"autoIncrement:true;unique; column:id; ->;<-:create" json:"-"`
UUID string `gorm:"primaryKey;autoIncrement:false;unique; column:uuid; ->;<-:create " json:"uuid" sql:"index"`
CreatedAt time.Time `gorm:"column:created_at; ->;<-:create " json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func NewPowerModel ¶
func NewPowerModel() *PowerModel
func (*PowerModel) GetForeignRefer ¶
func (mdl *PowerModel) GetForeignRefer() string
func (*PowerModel) GetForeignReferValue ¶
func (mdl *PowerModel) GetForeignReferValue() string
func (*PowerModel) GetID ¶
func (mdl *PowerModel) GetID() int32
func (*PowerModel) GetPowerModel ¶
func (mdl *PowerModel) GetPowerModel() ModelInterface
func (*PowerModel) GetPrimaryKey ¶
func (mdl *PowerModel) GetPrimaryKey() string
func (*PowerModel) GetTableName ¶
func (mdl *PowerModel) GetTableName(needFull bool) string
func (*PowerModel) GetUUID ¶
func (mdl *PowerModel) GetUUID() string
type PowerOperationLog ¶
type PowerOperationLog struct {
*PowerCompactModel
OperatorName *string `gorm:"column:operatorName" json:"operatorName"`
OperatorTable *string `gorm:"column:operatorTable" json:"operatorTable"`
OperatorID *int32 `gorm:"column:operatorID;index" json:"operatorID"`
Module *int16 `gorm:"column:module" json:"module"`
Operate *string `gorm:"column:operate" json:"operate"`
Event *int8 `gorm:"column:event" json:"event"`
ObjectName *string `gorm:"column:objectName" json:"objectName"`
ObjectTable *string `gorm:"column:objectTable" json:"objectTable"`
ObjectID *int32 `gorm:"column:objectID;index" json:"objectID"`
Result *int8 `gorm:"column:result" json:"result"`
}
PowerOperationLog 数据表结构
func NewPowerOperationLog ¶
func NewPowerOperationLog(mapObject *object.Collection) *PowerOperationLog
func (*PowerOperationLog) GetTableName ¶
func (mdl *PowerOperationLog) GetTableName(needFull bool) string
获取当前 Model 的数据库表名称
func (*PowerOperationLog) SaveOps ¶
func (mdl *PowerOperationLog) SaveOps(db *gorm.DB, operatorName string, operator ModelInterface, module int16, operate string, event int8, objectName string, object ModelInterface, result int8, ) error
func (*PowerOperationLog) TableName ¶
func (mdl *PowerOperationLog) TableName() string
TableName overrides the table name used by price_book to `profiles`
type PowerPivot ¶
type PowerPivot struct {
ID int32 `gorm:"AUTO_INCREMENT;PRIMARY_KEY;not null" json:"id"`
CreatedAt time.Time `gorm:"column:created_at; ->;<-:create " json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func NewPowerPivot ¶
func NewPowerPivot() *PowerPivot
func (*PowerPivot) GetForeignKey ¶
func (mdl *PowerPivot) GetForeignKey() string
func (*PowerPivot) GetForeignRefer ¶
func (mdl *PowerPivot) GetForeignRefer() string
func (*PowerPivot) GetForeignReferValue ¶
func (mdl *PowerPivot) GetForeignReferValue() string
func (*PowerPivot) GetForeignValue ¶
func (mdl *PowerPivot) GetForeignValue() string
func (*PowerPivot) GetID ¶
func (mdl *PowerPivot) GetID() int32
func (*PowerPivot) GetJoinKey ¶
func (mdl *PowerPivot) GetJoinKey() string
func (*PowerPivot) GetJoinValue ¶
func (mdl *PowerPivot) GetJoinValue() string
func (*PowerPivot) GetOwnerKey ¶
func (mdl *PowerPivot) GetOwnerKey() string
func (*PowerPivot) GetOwnerValue ¶
func (mdl *PowerPivot) GetOwnerValue() string
func (*PowerPivot) GetPivotComposedUniqueID ¶
func (mdl *PowerPivot) GetPivotComposedUniqueID() string
func (*PowerPivot) GetPowerModel ¶
func (mdl *PowerPivot) GetPowerModel() ModelInterface
func (*PowerPivot) GetPrimaryKey ¶
func (mdl *PowerPivot) GetPrimaryKey() string
func (*PowerPivot) GetTableName ¶
func (mdl *PowerPivot) GetTableName(needFull bool) string
--------------------------------------------------------------------
func (*PowerPivot) GetUUID ¶
func (mdl *PowerPivot) GetUUID() string
Click to show internal directories.
Click to hide internal directories.