pagedb

package
v1.0.1-rel-02 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: AFL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

@Title 文件名称: page_db_request.go @Description 描述: PageDbRequest

@Author 作者: leijianming@163.com 时间(2024-02-21 22:38:21) @Update 作者: leijianming@163.com 时间(2024-02-21 22:38:21)

Functions

func GeneralQueryAs

func GeneralQueryAs[T any](result *page.PageResult) *page.PageResult

func FindBeanInst[T any]() T {

func InjectCmdRequest

func InjectCmdRequest(s *CmdRequest)

func InjectPageDbCmd

func InjectPageDbCmd(s *PageDbCmd)

func InjectPageDbMeta

func InjectPageDbMeta(s *PageDbMeta)

func InjectPageDbQuery

func InjectPageDbQuery(s *PageDbQuery)

func InjectPageDbWebRequest

func InjectPageDbWebRequest(s *PageDbWebRequest)

func InjectSubTableDto

func InjectSubTableDto(s *SubTableDto)

func LoadCmdRequest

func LoadCmdRequest() baseiface.ISingleton

func LoadPageDbCmd

func LoadPageDbCmd() baseiface.ISingleton

func LoadPageDbMeta

func LoadPageDbMeta() baseiface.ISingleton

func LoadPageDbQuery

func LoadPageDbQuery() baseiface.ISingleton

func LoadPageDbWebRequest

func LoadPageDbWebRequest() baseiface.ISingleton

func LoadSubTableDto

func LoadSubTableDto() baseiface.ISingleton

Types

type AutoMigrateMeta

type AutoMigrateMeta struct {
	FieldTypes map[string]string
	FieldTags  map[string]string
}

func NewAutoMigrateMeta

func NewAutoMigrateMeta() *AutoMigrateMeta

func (*AutoMigrateMeta) AddField

func (self *AutoMigrateMeta) AddField(field string, fieldType string, fieldTag string)

func (*AutoMigrateMeta) FromStru

func (self *AutoMigrateMeta) FromStru(stru schema.Tabler)

func (*AutoMigrateMeta) FromStruFilter

func (self *AutoMigrateMeta) FromStruFilter(stru schema.Tabler, fields string)

fields f1,f2

func (*AutoMigrateMeta) Str2Garray

func (self *AutoMigrateMeta) Str2Garray(fields string) *garray.Array

type CmdRequest

type CmdRequest struct {
	basedto.BaseEntity
	PkeyValue any `json:"pkey_value,omitempty"`

	// map or struct
	Record      map[string]any `json:"update_record,omitempty"`
	GroupFields string         `json:"group_fields"`
	StatFields  string         `json:"stat_fields"`

	*AutoMigrateMeta `json:"auto_migrate_meta,omitempty"`
}

func FindBeanCmdRequest

func FindBeanCmdRequest() *CmdRequest

FindBeanCmdRequest

func NewCmdRequest

func NewCmdRequest() *CmdRequest

type IPagedbExecute

type IPagedbExecute interface {
	Execute(req *PageDbWebRequest) *page.PageResult
}

type PageDbCmd

type PageDbCmd struct {
	basedto.BaseEntitySingle
}

func FindBeanPageDbCmd

func FindBeanPageDbCmd() *PageDbCmd

FindBeanPageDbCmd

func NewPageDbCmd

func NewPageDbCmd() *PageDbCmd

func (*PageDbCmd) Execute

func (self *PageDbCmd) Execute(req *PageDbWebRequest) *page.PageResult

type PageDbMeta

type PageDbMeta struct {
	basedto.BaseEntitySingle
}

func FindBeanPageDbMeta

func FindBeanPageDbMeta() *PageDbMeta

FindBeanPageDbMeta

func NewPageDbMeta

func NewPageDbMeta() *PageDbMeta

func (*PageDbMeta) AutoMigrateMeta

func (self *PageDbMeta) AutoMigrateMeta(req *PageDbWebRequest, stru schema.Tabler) *PageDbMeta

func (*PageDbMeta) DbAutoMigrate

func (self *PageDbMeta) DbAutoMigrate(req *PageDbWebRequest) *page.PageResult

func (*PageDbMeta) Execute

func (self *PageDbMeta) Execute(req *PageDbWebRequest) *page.PageResult

type PageDbQuery

type PageDbQuery struct {
	basedto.BaseEntitySingle
}

func FindBeanPageDbQuery

func FindBeanPageDbQuery() *PageDbQuery

FindBeanPageDbQuery

func NewPageDbQuery

func NewPageDbQuery() *PageDbQuery

func (*PageDbQuery) Execute

func (self *PageDbQuery) Execute(req *PageDbWebRequest) *page.PageResult

type PageDbRequest

type PageDbRequest struct {
	*page.PageRequest

	//表名
	TableName string `json:"table_name"`
	//Pkey
	PkeyField string `json:"pkey_field"`
	//字段列表,分隔
	FieldsName string `json:"fields_name"`
	//返回日期转为int64
	TimeToInt bool `json:"time_to_int"`

	//ui request will format result2 standard!
	UiFlag    bool         `json:"ui_flag"`
	SubTable  *SubTableDto `json:"-"`
	JoinTable *SubTableDto `json:"-"`
	UiReq     bool         `json:"ui_req"`
	// contains filtered or unexported fields
}

通用表查询请求数据

func Default

func Default() *PageDbRequest

func DefaultCms

func DefaultCms() *PageDbRequest

func DefaultCockDb

func DefaultCockDb() *PageDbRequest

func DefaultHub

func DefaultHub() *PageDbRequest

func DefaultMedusa

func DefaultMedusa() *PageDbRequest

func DefaultMysql

func DefaultMysql() *PageDbRequest

func InnerDefault

func InnerDefault() *PageDbRequest

func NewPageDbRequest

func NewPageDbRequest(pageSize int) *PageDbRequest

func (*PageDbRequest) Clear

func (self *PageDbRequest) Clear() *PageDbRequest

func (*PageDbRequest) Col2ColType

func (self *PageDbRequest) Col2ColType(colType string, colName string) (reflect.Type, bool)

func (*PageDbRequest) Col2ColTypePtr

func (self *PageDbRequest) Col2ColTypePtr(colType string, colName string) (reflect.Type, bool)

func (*PageDbRequest) CountMap

func (self *PageDbRequest) CountMap() (int, error)

func (*PageDbRequest) CreateDbTableStru

func (self *PageDbRequest) CreateDbTableStru(meta *dbpkgdto.MetaTableDto) reflect.Value

func (*PageDbRequest) CreateDynacStru

func (self *PageDbRequest) CreateDynacStru() reflect.Value

func (*PageDbRequest) CreateStatStru

func (self *PageDbRequest) CreateStatStru(groupFields string, statField ...string) any

func (*PageDbRequest) CreateTableStru

func (self *PageDbRequest) CreateTableStru() (reflect.Value, error)

func (*PageDbRequest) DefaultTableFields

func (self *PageDbRequest) DefaultTableFields() *PageDbRequest

func (*PageDbRequest) FieldNames2SnakeCase

func (self *PageDbRequest) FieldNames2SnakeCase()

func (*PageDbRequest) FindMap

func (self *PageDbRequest) FindMap(result interface{}) error

func (*PageDbRequest) FindRecords

func (self *PageDbRequest) FindRecords(result *page.PageResult) *page.PageResult

func (*PageDbRequest) FindRecordsNew

func (self *PageDbRequest) FindRecordsNew(result *page.PageResult) *page.PageResult

func (*PageDbRequest) FindTable

func (self *PageDbRequest) FindTable() *gorm.DB

func (*PageDbRequest) GeneralQuery

func (self *PageDbRequest) GeneralQuery() *page.PageResult

this.WriteDaoFile() pageResult.WriteDaoFile(this.TableName)

func (*PageDbRequest) GeneralQueryAs

func (self *PageDbRequest) GeneralQueryAs(models any) *page.PageResult

func (*PageDbRequest) GeneralQueryDto

func (self *PageDbRequest) GeneralQueryDto() *page.PageResult

func (*PageDbRequest) GeneralQueryNew

func (self *PageDbRequest) GeneralQueryNew() *page.PageResult

func (*PageDbRequest) GeneralQueryPageui

func (self *PageDbRequest) GeneralQueryPageui() *pageui.PageuiResult

func (*PageDbRequest) GeneralRows

func (self *PageDbRequest) GeneralRows() *page.PageResult

func (*PageDbRequest) GeneralScanTable

func (self *PageDbRequest) GeneralScanTable() *page.PageResult

func (*PageDbRequest) GeneralScanTable2Ui

func (self *PageDbRequest) GeneralScanTable2Ui() *pageui.PageuiResult

func (*PageDbRequest) GeneralTakeTable

func (self *PageDbRequest) GeneralTakeTable() *page.PageResult

func (*PageDbRequest) GroupStat

func (self *PageDbRequest) GroupStat(groupFields string, statfields ...string) ([]map[string]any, error)

func (*PageDbRequest) GroupStat0

func (self *PageDbRequest) GroupStat0(groupFields string, statfields ...string) ([]map[string]any, error)

func (*PageDbRequest) GroupStatBase

func (self *PageDbRequest) GroupStatBase(groupField, statfield string) (*dto.GroupResult, error)

func (*PageDbRequest) IfExistField

func (self *PageDbRequest) IfExistField(field string) bool

func (*PageDbRequest) IfSubTable

func (self *PageDbRequest) IfSubTable() bool

func (*PageDbRequest) InitFields

func (self *PageDbRequest) InitFields() *page.PageResult

func (*PageDbRequest) InitPage

func (self *PageDbRequest) InitPage()

func (*PageDbRequest) MetadataFactroy

func (self *PageDbRequest) MetadataFactroy() *service.MetadataFactroy

func (*PageDbRequest) MetadataPkey

func (self *PageDbRequest) MetadataPkey() *basedto.IchubResult

func (*PageDbRequest) MetadataQuery

func (self *PageDbRequest) MetadataQuery() *basedto.IchubResult

func (*PageDbRequest) MetadataQuery2PageResult

func (self *PageDbRequest) MetadataQuery2PageResult() *page.PageResult

func (*PageDbRequest) Models

func (self *PageDbRequest) Models() any

func (*PageDbRequest) NewSubTable

func (self *PageDbRequest) NewSubTable() *PageDbRequest

func (*PageDbRequest) QueryMap

func (self *PageDbRequest) QueryMap() *page.PageResult

func (*PageDbRequest) QuerySubTable

func (self *PageDbRequest) QuerySubTable(records []map[string]interface{})

func (*PageDbRequest) RawSql

func (self *PageDbRequest) RawSql(sql string, values ...any) *page.PageResult

func (*PageDbRequest) ScanRecords

func (self *PageDbRequest) ScanRecords(db *gorm.DB, rows *sql.Rows) (any, error)

func (*PageDbRequest) ScanTable

func (self *PageDbRequest) ScanTable(dbentity any) (any, error)

func (*PageDbRequest) Select

func (self *PageDbRequest) Select(sql string) *page.PageResult

func (*PageDbRequest) SetFieldsName

func (self *PageDbRequest) SetFieldsName(FieldsName string) *PageDbRequest

func (*PageDbRequest) SetMetadataFactroy

func (self *PageDbRequest) SetMetadataFactroy(metadataFactroy *service.MetadataFactroy)

func (*PageDbRequest) SetModels

func (self *PageDbRequest) SetModels(models any)

func (*PageDbRequest) SetPageCurrent

func (self *PageDbRequest) SetPageCurrent(PageCurrent int) *PageDbRequest

func (*PageDbRequest) SetPageSize

func (self *PageDbRequest) SetPageSize(PageSize int) *PageDbRequest

func (*PageDbRequest) SetTableName

func (self *PageDbRequest) SetTableName(TableName string) *PageDbRequest

func (*PageDbRequest) SetTabler

func (c *PageDbRequest) SetTabler(tabler schema.Tabler)

func (*PageDbRequest) SetTimeToInt

func (self *PageDbRequest) SetTimeToInt(TimeToInt bool) *PageDbRequest

func (*PageDbRequest) Stat

func (self *PageDbRequest) Stat(statfields ...string) (map[string]any, error)

var sql = `select groupFields, sum(statField) ,max(statField),count(statField) ,

min(statField),count(statField) ,avg(statField)	from ` + self.TableName

func (*PageDbRequest) StatBase

func (self *PageDbRequest) StatBase(statfield string) (*dto.GroupResult, error)

func (*PageDbRequest) Tabler

func (c *PageDbRequest) Tabler() schema.Tabler

func (*PageDbRequest) ValueOfPageRequest

func (self *PageDbRequest) ValueOfPageRequest(that *PageDbRequest) *PageDbRequest

func (*PageDbRequest) WriteDaoFile

func (self *PageDbRequest) WriteDaoFile() error

type PageDbWebRequest

type PageDbWebRequest struct {
	basedto.BaseEntity
	*PagedbGroup

	CmdCatagory int `json:"cmd_catagory"`
	CmdType     int `json:"cmd_type"`
}

func DefaultWebRequest

func DefaultWebRequest() *PageDbWebRequest

func FindBeanPageDbWebRequest

func FindBeanPageDbWebRequest() *PageDbWebRequest

FindBeanPageDbWebRequest

func NewPageDbWebRequest

func NewPageDbWebRequest() *PageDbWebRequest

func (*PageDbWebRequest) AutoMeta

func (self *PageDbWebRequest) AutoMeta(stru schema.Tabler) *PageDbWebRequest

func (*PageDbWebRequest) Cmd

func (self *PageDbWebRequest) Cmd() *page.PageResult

func (*PageDbWebRequest) Execute

func (self *PageDbWebRequest) Execute() *page.PageResult

func (*PageDbWebRequest) FindById

func (self *PageDbWebRequest) FindById(pkeyValue any) *page.PageResult

func (*PageDbWebRequest) FindExecute

func (self *PageDbWebRequest) FindExecute() IPagedbExecute

func (*PageDbWebRequest) GeneralQuery

func (self *PageDbWebRequest) GeneralQuery() *page.PageResult

func (*PageDbWebRequest) GroupStat

func (self *PageDbWebRequest) GroupStat(groupFields, statFields string) *page.PageResult

func (*PageDbWebRequest) MakeMeta

func (self *PageDbWebRequest) MakeMeta() error

func (*PageDbWebRequest) MetaQuery

func (self *PageDbWebRequest) MetaQuery() *page.PageResult

func (*PageDbWebRequest) Query

func (self *PageDbWebRequest) Query() *page.PageResult

func (*PageDbWebRequest) SetTabler

func (c *PageDbWebRequest) SetTabler(tabler schema.Tabler)

func (*PageDbWebRequest) Stat

func (self *PageDbWebRequest) Stat(statFields string) *page.PageResult

type PagedbGroup

type PagedbGroup struct {
	*PageDbRequest
	*CmdRequest
	// contains filtered or unexported fields
}

func DefaultDbGroup

func DefaultDbGroup() *PagedbGroup

func NewPagedbGroup

func NewPagedbGroup() *PagedbGroup

func (*PagedbGroup) CreateDbTableStru

func (self *PagedbGroup) CreateDbTableStru(meta *dbpkgdto.MetaTableDto) reflect.Value

func (*PagedbGroup) CreateDbTableStruMeta

func (self *PagedbGroup) CreateDbTableStruMeta() reflect.Value

func (*PagedbGroup) CreateDbTableStruMetaOf

func (self *PagedbGroup) CreateDbTableStruMetaOf(meta *AutoMigrateMeta) reflect.Value

func (*PagedbGroup) CreateStatStru

func (self *PagedbGroup) CreateStatStru(groupFields string, statField ...string) any

func (*PagedbGroup) CreateTableRecord

func (self *PagedbGroup) CreateTableRecord() (any, error)

func (*PagedbGroup) CreateTableRecordMeta

func (self *PagedbGroup) CreateTableRecordMeta() any

func (*PagedbGroup) CreateTableStru

func (self *PagedbGroup) CreateTableStru() (reflect.Value, error)

func (*PagedbGroup) DbFindById

func (self *PagedbGroup) DbFindById(pkey any) (any, error)

func (*PagedbGroup) DbGroupStat

func (self *PagedbGroup) DbGroupStat(groupFields string, statfields ...string) ([]map[string]any, error)

func (*PagedbGroup) DbStat

func (self *PagedbGroup) DbStat(statfield ...string) (map[string]any, error)

var sql = `select groupFields, sum(statField) ,max(statField),count(statField) ,

min(statField),count(statField) ,avg(statField)	from ` + self.TableName

func (*PagedbGroup) DeleteById

func (self *PagedbGroup) DeleteById(pkeyValue any) error

func (*PagedbGroup) DeleteWhere

func (self *PagedbGroup) DeleteWhere() error

func (*PagedbGroup) FindMeta

func (self *PagedbGroup) FindMeta() *dbpkgdto.MetaTableDto

func (*PagedbGroup) FindPkName

func (self *PagedbGroup) FindPkName() string

func (*PagedbGroup) GeneralScanTable

func (self *PagedbGroup) GeneralScanTable() *page.PageResult

func (*PagedbGroup) Init

func (self *PagedbGroup) Init()

func (*PagedbGroup) Insert

func (self *PagedbGroup) Insert(entity any) (map[string]any, error)

func (*PagedbGroup) InsertEntity

func (self *PagedbGroup) InsertEntity(entity baseiface.IbaseProxy) (any, error)

func (*PagedbGroup) InsertMap

func (self *PagedbGroup) InsertMap(record map[string]any) (map[string]any, error)

func (*PagedbGroup) Save

func (self *PagedbGroup) Save(entity any, pk string, v any) (any, error)

no primary key will insert

func (*PagedbGroup) SetField

func (self *PagedbGroup) SetField(entity any, key *dbpkgdto.MetaGoField, value any) error

func (*PagedbGroup) SetTabler

func (c *PagedbGroup) SetTabler(tabler schema.Tabler)

func (*PagedbGroup) Update

func (self *PagedbGroup) Update(entity any, pkeyValue any) (any, error)

func (*PagedbGroup) UpdateEntity

func (self *PagedbGroup) UpdateEntity(entity baseiface.IbaseProxy, pkeyValue any) (any, error)

func (*PagedbGroup) UpdateMap

func (self *PagedbGroup) UpdateMap(record map[string]any, pkeyValue any) (any, error)

func (*PagedbGroup) UpdateNotNull

func (self *PagedbGroup) UpdateNotNull(maps map[string]any, pkeyValue any) (any, error)

func (*PagedbGroup) Updates

func (self *PagedbGroup) Updates(record map[string]any, pkeyValue any) (any, error)

updates Zero

type PagedbRequestModel

type PagedbRequestModel[T any] struct {
	*PageDbRequest
}

func DefaultModel

func DefaultModel[T any]() *PagedbRequestModel[T]

func DefaultModelCockdb

func DefaultModelCockdb[T any]() *PagedbRequestModel[T]

func DefaultModelMedusa

func DefaultModelMedusa[T any]() *PagedbRequestModel[T]

func DefaultModelMysql

func DefaultModelMysql[T any]() *PagedbRequestModel[T]

func NewPagedbRequestModel

func NewPagedbRequestModel[T any]() *PagedbRequestModel[T]

func (*PagedbRequestModel[T]) DeleteById

func (self *PagedbRequestModel[T]) DeleteById(id int64, keys ...string) *pagemodel.IchubResult[T]

func (*PagedbRequestModel[T]) DeleteByIdOf

func (self *PagedbRequestModel[T]) DeleteByIdOf(id int64, model *T, keys ...string) *pagemodel.IchubResult[T]

func (*PagedbRequestModel[T]) FindById

func (self *PagedbRequestModel[T]) FindById(id int64, keys ...string) *pagemodel.IchubResult[T]

func (*PagedbRequestModel[T]) FindByIds

func (self *PagedbRequestModel[T]) FindByIds(ids string, keys ...string) *pagemodel.PageResult[T]

func (*PagedbRequestModel[T]) GeneralQuery

func (self *PagedbRequestModel[T]) GeneralQuery() *pagemodel.PageResult[T]

func (*PagedbRequestModel[T]) Insert

func (self *PagedbRequestModel[T]) Insert(entity *T) error

func (*PagedbRequestModel[T]) Insert2Result

func (self *PagedbRequestModel[T]) Insert2Result(entity *T) *pagemodel.IchubResult[T]

func (*PagedbRequestModel[T]) Query

func (self *PagedbRequestModel[T]) Query() *pagemodel.PageResult[T]

func (*PagedbRequestModel[T]) Update

func (self *PagedbRequestModel[T]) Update(entity *T) error

func (*PagedbRequestModel[T]) Update2Result

func (self *PagedbRequestModel[T]) Update2Result(entity *T) *pagemodel.IchubResult[T]

type SubTableDto

type SubTableDto struct {
	basedto.BaseEntity

	TableName  string            `json:"table_name"`
	FieldsName string            `json:"fields_name"`
	PageSize   int               `json:"page_size"`
	JoinKeys   map[string]string `json:"join_keys"`
}

func FindBeanSubTableDto

func FindBeanSubTableDto() *SubTableDto

FindBeanSubTableDto

func NewSubTableDto

func NewSubTableDto() *SubTableDto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL