model

package
v0.0.0-...-293ac38 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteOneByNameWhereParameter

type DeleteOneByNameWhereParameter struct {
	NameEqual string
}

DeleteOneByNameWhereParameter is a where parameter structure.

type DeleteOneOrderByIDAscWhereParameter

type DeleteOneOrderByIDAscWhereParameter struct {
	NameEqual string
}

DeleteOneOrderByIDAscWhereParameter is a where parameter structure.

type DeleteOneOrderByIDDescLimitCountLimitParameter

type DeleteOneOrderByIDDescLimitCountLimitParameter struct {
	Count int
}

DeleteOneOrderByIDDescLimitCountLimitParameter is a limit parameter structure.

type DeleteOneOrderByIDDescLimitCountWhereParameter

type DeleteOneOrderByIDDescLimitCountWhereParameter struct {
	NameEqual string
}

DeleteOneOrderByIDDescLimitCountWhereParameter is a where parameter structure.

type DeleteOneOrderByIDDescWhereParameter

type DeleteOneOrderByIDDescWhereParameter struct {
	NameEqual string
}

DeleteOneOrderByIDDescWhereParameter is a where parameter structure.

type DeleteOneWhereParameter

type DeleteOneWhereParameter struct {
	IdEqual uint64
}

DeleteOneWhereParameter is a where parameter structure.

type FindAllCountResult

type FindAllCountResult struct {
	CountID sql.NullInt64 `gorm:"column:countID" json:"countID"`
}

FindAllCountResult is a find all count result.

func (FindAllCountResult) TableName

func (FindAllCountResult) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type FindAllCountWhereResult

type FindAllCountWhereResult struct {
	CountID sql.NullInt64 `gorm:"column:countID" json:"countID"`
}

FindAllCountWhereResult is a find all count where result.

func (FindAllCountWhereResult) TableName

func (FindAllCountWhereResult) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type FindAllCountWhereWhereParameter

type FindAllCountWhereWhereParameter struct {
	IdGT uint64
}

FindAllCountWhereWhereParameter is a where parameter structure.

type FindAvgIDResult

type FindAvgIDResult struct {
	AvgID decimal.NullDecimal `gorm:"column:avgID" json:"avgID"`
}

FindAvgIDResult is a find avg id result.

func (FindAvgIDResult) TableName

func (FindAvgIDResult) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type FindGroupHavingLimitOffsetHavingParameter

type FindGroupHavingLimitOffsetHavingParameter struct {
	IdGT uint64
}

FindGroupHavingLimitOffsetHavingParameter is a having parameter structure.

type FindGroupHavingLimitOffsetLimitParameter

type FindGroupHavingLimitOffsetLimitParameter struct {
	Count  int
	Offset int
}

FindGroupHavingLimitOffsetLimitParameter is a limit parameter structure.

type FindGroupHavingLimitOffsetWhereParameter

type FindGroupHavingLimitOffsetWhereParameter struct {
	IdGT uint64
}

FindGroupHavingLimitOffsetWhereParameter is a where parameter structure.

type FindGroupHavingOrderAscLimitOffsetHavingParameter

type FindGroupHavingOrderAscLimitOffsetHavingParameter struct {
	IdGT uint64
}

FindGroupHavingOrderAscLimitOffsetHavingParameter is a having parameter structure.

type FindGroupHavingOrderAscLimitOffsetLimitParameter

type FindGroupHavingOrderAscLimitOffsetLimitParameter struct {
	Count  int
	Offset int
}

FindGroupHavingOrderAscLimitOffsetLimitParameter is a limit parameter structure.

type FindGroupHavingOrderAscLimitOffsetWhereParameter

type FindGroupHavingOrderAscLimitOffsetWhereParameter struct {
	IdGT uint64
}

FindGroupHavingOrderAscLimitOffsetWhereParameter is a where parameter structure.

type FindGroupHavingOrderDescLimitOffsetHavingParameter

type FindGroupHavingOrderDescLimitOffsetHavingParameter struct {
	IdGT uint64
}

FindGroupHavingOrderDescLimitOffsetHavingParameter is a having parameter structure.

type FindGroupHavingOrderDescLimitOffsetLimitParameter

type FindGroupHavingOrderDescLimitOffsetLimitParameter struct {
	Count  int
	Offset int
}

FindGroupHavingOrderDescLimitOffsetLimitParameter is a limit parameter structure.

type FindGroupHavingOrderDescLimitOffsetWhereParameter

type FindGroupHavingOrderDescLimitOffsetWhereParameter struct {
	IdGT uint64
}

FindGroupHavingOrderDescLimitOffsetWhereParameter is a where parameter structure.

type FindGroupLimitOffsetLimitParameter

type FindGroupLimitOffsetLimitParameter struct {
	Count  int
	Offset int
}

FindGroupLimitOffsetLimitParameter is a limit parameter structure.

type FindGroupLimitOffsetWhereParameter

type FindGroupLimitOffsetWhereParameter struct {
	IdGT uint64
}

FindGroupLimitOffsetWhereParameter is a where parameter structure.

type FindLimitLimitParameter

type FindLimitLimitParameter struct {
	Count int
}

FindLimitLimitParameter is a limit parameter structure.

type FindLimitOffsetLimitParameter

type FindLimitOffsetLimitParameter struct {
	Count  int
	Offset int
}

FindLimitOffsetLimitParameter is a limit parameter structure.

type FindLimitWhereParameter

type FindLimitWhereParameter struct {
	IdGT uint64
}

FindLimitWhereParameter is a where parameter structure.

type FindMaxIDResult

type FindMaxIDResult struct {
	MaxID sql.NullInt64 `gorm:"column:maxID" json:"maxID"`
}

FindMaxIDResult is a find max id result.

func (FindMaxIDResult) TableName

func (FindMaxIDResult) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type FindMinIDResult

type FindMinIDResult struct {
	MinID sql.NullInt64 `gorm:"column:minID" json:"minID"`
}

FindMinIDResult is a find min id result.

func (FindMinIDResult) TableName

func (FindMinIDResult) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type FindOneByNameWhereParameter

type FindOneByNameWhereParameter struct {
	NameEqual string
}

FindOneByNameWhereParameter is a where parameter structure.

type FindOneGroupByNameHavingNameHavingParameter

type FindOneGroupByNameHavingNameHavingParameter struct {
	NameEqual string
}

FindOneGroupByNameHavingNameHavingParameter is a having parameter structure.

type FindOneGroupByNameHavingNameWhereParameter

type FindOneGroupByNameHavingNameWhereParameter struct {
	NameEqual string
}

FindOneGroupByNameHavingNameWhereParameter is a where parameter structure.

type FindOneGroupByNameWhereParameter

type FindOneGroupByNameWhereParameter struct {
	NameEqual string
}

FindOneGroupByNameWhereParameter is a where parameter structure.

type FindOnePartWhereParameter

type FindOnePartWhereParameter struct {
	IdGT uint64
}

FindOnePartWhereParameter is a where parameter structure.

type FindOneWhereParameter

type FindOneWhereParameter struct {
	IdEqual uint64
}

FindOneWhereParameter is a where parameter structure.

type TxFindOneWhereParameter

type TxFindOneWhereParameter struct {
	IdEqual uint64
}

TxFindOneWhereParameter is a where parameter structure.

type TxGetAndSetTransactionParameter

type TxGetAndSetTransactionParameter struct {
	TxFindOneWhereParameter TxFindOneWhereParameter
	User                    User
	TxUpdateWhereParameter  TxUpdateWhereParameter
}

type TxUpdateWhereParameter

type TxUpdateWhereParameter struct {
	IdEqual uint64
}

TxUpdateWhereParameter is a where parameter structure.

type UpdateOrderByIdDescLimitCountLimitParameter

type UpdateOrderByIdDescLimitCountLimitParameter struct {
	Count int
}

UpdateOrderByIdDescLimitCountLimitParameter is a limit parameter structure.

type UpdateOrderByIdDescLimitCountWhereParameter

type UpdateOrderByIdDescLimitCountWhereParameter struct {
	IdEqual uint64
}

UpdateOrderByIdDescLimitCountWhereParameter is a where parameter structure.

type UpdateOrderByIdDescWhereParameter

type UpdateOrderByIdDescWhereParameter struct {
	IdEqual uint64
}

UpdateOrderByIdDescWhereParameter is a where parameter structure.

type UpdateWhereParameter

type UpdateWhereParameter struct {
	IdEqual uint64
}

UpdateWhereParameter is a where parameter structure.

type User

type User struct {
	Id       uint64    `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	Name     string    `gorm:"column:name" json:"name"`         // The username
	Password string    `gorm:"column:password" json:"password"` // The  user password
	Mobile   string    `gorm:"column:mobile" json:"mobile"`     // The mobile phone number
	Gender   string    `gorm:"column:gender" json:"gender"`     // gender,male|female|unknown
	Nickname string    `gorm:"column:nickname" json:"nickname"` // The nickname
	Type     int8      `gorm:"column:type" json:"type"`         // The user type, 0:normal,1:vip, for test golang keyword
	CreateAt time.Time `gorm:"column:create_at" json:"createAt"`
	UpdateAt time.Time `gorm:"column:update_at" json:"updateAt"`
}

User represents a user struct data.

func (User) TableName

func (User) TableName() string

TableName returns the table name. it implemented by gorm.Tabler.

type UserModel

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

UserModel represents a user model.

func NewUserModel

func NewUserModel(db *gorm.DB) *UserModel

NewUserModel returns a new user model.

func (*UserModel) Create

func (m *UserModel) Create(ctx context.Context, data ...*User) error

Create creates user data.

func (*UserModel) Customize

func (m *UserModel) Customize(ctx context.Context, args ...interface{})

TODO(sqlgen): Add your own customize code here.

func (*UserModel) DeleteOne

func (m *UserModel) DeleteOne(ctx context.Context, where DeleteOneWhereParameter) error

DeleteOne is generated from sql: delete from `user` where `id` = ?;

func (*UserModel) DeleteOneByName

func (m *UserModel) DeleteOneByName(ctx context.Context, where DeleteOneByNameWhereParameter) error

DeleteOneByName is generated from sql: delete from `user` where `name` = ?;

func (*UserModel) DeleteOneOrderByIDAsc

func (m *UserModel) DeleteOneOrderByIDAsc(ctx context.Context, where DeleteOneOrderByIDAscWhereParameter) error

DeleteOneOrderByIDAsc is generated from sql: delete from `user` where `name` = ? order by id;

func (*UserModel) DeleteOneOrderByIDDesc

func (m *UserModel) DeleteOneOrderByIDDesc(ctx context.Context, where DeleteOneOrderByIDDescWhereParameter) error

DeleteOneOrderByIDDesc is generated from sql: delete from `user` where `name` = ? order by id desc;

func (*UserModel) DeleteOneOrderByIDDescLimitCount

DeleteOneOrderByIDDescLimitCount is generated from sql: delete from `user` where `name` = ? order by id desc limit ?;

func (*UserModel) FindAll

func (m *UserModel) FindAll(ctx context.Context) ([]*User, error)

FindAll is generated from sql: select * from `user`;

func (*UserModel) FindAllCount

func (m *UserModel) FindAllCount(ctx context.Context) (*FindAllCountResult, error)

FindAllCount is generated from sql: select count(id) AS countID from `user`;

func (*UserModel) FindAllCountWhere

FindAllCountWhere is generated from sql: select count(id) AS countID from `user` where id > ?;

func (*UserModel) FindAvgID

func (m *UserModel) FindAvgID(ctx context.Context) (*FindAvgIDResult, error)

FindAvgID is generated from sql: select avg(id) AS avgID from `user`;

func (*UserModel) FindGroupHavingLimitOffset

FindGroupHavingLimitOffset is generated from sql: select * from `user` where id > ? group by name having id > ? limit ?, ?;

func (*UserModel) FindGroupHavingOrderAscLimitOffset

FindGroupHavingOrderAscLimitOffset is generated from sql: select * from `user` where id > ? group by name having id > ? order by id limit ?, ?;

func (*UserModel) FindGroupHavingOrderDescLimitOffset

FindGroupHavingOrderDescLimitOffset is generated from sql: select * from `user` where id > ? group by name having id > ? order by id desc limit ?, ?;

func (*UserModel) FindGroupLimitOffset

FindGroupLimitOffset is generated from sql: select * from `user` where id > ? group by name limit ?, ?;

func (*UserModel) FindLimit

func (m *UserModel) FindLimit(ctx context.Context, where FindLimitWhereParameter, limit FindLimitLimitParameter) ([]*User, error)

FindLimit is generated from sql: select * from `user` where id > ? limit ?;

func (*UserModel) FindLimitOffset

func (m *UserModel) FindLimitOffset(ctx context.Context, limit FindLimitOffsetLimitParameter) ([]*User, error)

FindLimitOffset is generated from sql: select * from `user` limit ?, ?;

func (*UserModel) FindMaxID

func (m *UserModel) FindMaxID(ctx context.Context) (*FindMaxIDResult, error)

FindMaxID is generated from sql: select max(id) AS maxID from `user`;

func (*UserModel) FindMinID

func (m *UserModel) FindMinID(ctx context.Context) (*FindMinIDResult, error)

FindMinID is generated from sql: select min(id) AS minID from `user`;

func (*UserModel) FindOne

func (m *UserModel) FindOne(ctx context.Context, where FindOneWhereParameter) (*User, error)

FindOne is generated from sql: select * from `user` where `id` = ? limit 1;

func (*UserModel) FindOneByName

func (m *UserModel) FindOneByName(ctx context.Context, where FindOneByNameWhereParameter) (*User, error)

FindOneByName is generated from sql: select * from `user` where `name` = ? limit 1;

func (*UserModel) FindOneGroupByName

func (m *UserModel) FindOneGroupByName(ctx context.Context, where FindOneGroupByNameWhereParameter) (*User, error)

FindOneGroupByName is generated from sql: select * from `user` where `name` = ? group by name limit 1;

func (*UserModel) FindOneGroupByNameHavingName

FindOneGroupByNameHavingName is generated from sql: select * from `user` where `name` = ? group by name having name = ? limit 1;

func (*UserModel) FindOnePart

func (m *UserModel) FindOnePart(ctx context.Context, where FindOnePartWhereParameter) (*User, error)

FindOnePart is generated from sql: select `name`, `password`, `mobile` from `user` where id > ? limit 1;

func (*UserModel) TxGetAndSet

func (m *UserModel) TxGetAndSet(ctx context.Context, parameter TxGetAndSetTransactionParameter)

TxGetAndSet is generated from sql: start transaction; select * from user where id = ? limit 1; update user set name = ? where id = ?; commit;

func (*UserModel) Update

func (m *UserModel) Update(ctx context.Context, data *User, where UpdateWhereParameter) error

Update is generated from sql: update `user` set `name` = ?, `password` = ?, `mobile` = ?, `gender` = ?, `nickname` = ?, `type` = ?, `create_at` = ?, `update_at` = ? where `id` = ?;

func (*UserModel) UpdateOrderByIdDesc

func (m *UserModel) UpdateOrderByIdDesc(ctx context.Context, data *User, where UpdateOrderByIdDescWhereParameter) error

UpdateOrderByIdDesc is generated from sql: update `user` set `name` = ?, `password` = ?, `mobile` = ?, `gender` = ?, `nickname` = ?, `type` = ?, `create_at` = ?, `update_at` = ? where `id` = ? order by id desc;

func (*UserModel) UpdateOrderByIdDescLimitCount

UpdateOrderByIdDescLimitCount is generated from sql: update `user` set `name` = ?, `password` = ?, `mobile` = ?, `gender` = ?, `nickname` = ?, `type` = ?, `create_at` = ?, `update_at` = ? where `id` = ? order by id desc limit ?;

Jump to

Keyboard shortcuts

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