base

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MPL-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRepository

type BaseRepository struct {
	// contains filtered or unexported fields
}

func NewBaseRepository

func NewBaseRepository(orm *xorm.Engine, column map[string]search.Filter) BaseRepository

func (*BaseRepository) Query

func (b *BaseRepository) Query(ctx context.Context, cq common.Query, list interface{}, count interface{}, cols ...string) (page *common.Pagination, err error)

func (*BaseRepository) ReadById

func (b *BaseRepository) ReadById(ctx context.Context, id int64, bean interface{}, cols ...string) (bool, error)

func (*BaseRepository) Save

func (b *BaseRepository) Save(bean interface{}) (int64, error)

func (*BaseRepository) Session

func (b *BaseRepository) Session(ctx context.Context) *xorm.Session

func (*BaseRepository) TxSave

func (b *BaseRepository) TxSave(tx *xorm.Session, bean interface{}) (int64, error)

func (*BaseRepository) TxUpdate

func (b *BaseRepository) TxUpdate(tx *xorm.Session, id int64, bean interface{}, cols ...string) (int64, error)

func (*BaseRepository) Update

func (b *BaseRepository) Update(id int64, bean interface{}, cols ...string) (int64, error)

func (*BaseRepository) Xorm

func (b *BaseRepository) Xorm() *xorm.Engine

type Entity

type Entity struct {
	Id             int64 `xorm:"pk autoincr bigint comment('主键/周进/2020-02-02')" json:"id"`
	CreateBy       int64 `xorm:"bigint not null comment('创建者/周进/2020-02-02')" json:"createBy"`
	CreateTime     int64 `xorm:"bigint not null comment('创建时间/周进/2020-02-02')" json:"createTime"`
	LastModifyBy   int64 `xorm:"bigint null COMMENT('记录最后修改者/黄旭龙/2020-02-02')" json:"lastModifyBy"`
	LastModifyTime int64 `xorm:"bigint null COMMENT('记录最后修改时间/黄旭龙/2020-02-02')" json:"lastModifyTime"`
}

func (*Entity) BeforeInsert

func (t *Entity) BeforeInsert()

func (*Entity) BeforeUpdate

func (t *Entity) BeforeUpdate()

type IBaseRepository

type IBaseRepository interface {
	Save(bean interface{}) (int64, error)
	Update(id int64, bean interface{}, cols ...string) (int64, error)
	ReadById(ctx context.Context, id int64, bean interface{}, cols ...string) (bool, error)
	Query(ctx context.Context, cq common.Query, list interface{}, count interface{}, cols ...string) (page *common.Pagination, err error)
	Session(ctx context.Context) *xorm.Session
	TxSave(tx *xorm.Session, bean interface{}) (int64, error)
	TxUpdate(tx *xorm.Session, id int64, bean interface{}, cols ...string) (int64, error)
}

Jump to

Keyboard shortcuts

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