test

package
v0.0.0-...-61829c1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBTest = sqlx.NewDatabase("test")
View Source
var UserField = struct {
	Name       string
	Username   string
	Nickname   string
	Gender     string
	Birthday   string
	Boolean    string
	CreateTime string
	UpdateTime string
	ID         string
	Enabled    string
}{
	Name:       "Name",
	Username:   "Username",
	Nickname:   "Nickname",
	Gender:     "Gender",
	Birthday:   "Birthday",
	Boolean:    "Boolean",
	CreateTime: "CreateTime",
	UpdateTime: "UpdateTime",
	ID:         "ID",
	Enabled:    "Enabled",
}

Functions

This section is empty.

Types

type Gender

type Gender int
const (
	GenderMale Gender = iota + 1
	GenderFemale
)

func (Gender) String

func (g Gender) String() string

type User

type User struct {
	// 姓名
	Name     string                `db:"F_name" json:"name" sql:"varchar(255) NOT NULL DEFAULT ''"`
	Username string                `db:"F_username" json:"username" sql:"varchar(255) NOT NULL DEFAULT ''"`
	Nickname string                `db:"F_nickname" json:"nickname" sql:"varchar(255) NOT NULL DEFAULT ''"`
	Gender   Gender                `db:"F_gender" json:"gender" sql:"int NOT NULL DEFAULT '0'"`
	Birthday timelib.MySQLDatetime `db:"F_birthday" json:"birthday" sql:"datetime NOT NULL DEFAULT CURRENT_TIMESTAMP"`
	Boolean  bool                  `db:"F_boolean" json:"boolean" sql:"boolean NOT NULL DEFAULT '0'"`
	presets.OperateTime
	presets.PrimaryID
	presets.SoftDelete
}

@def primary ID @def index I_nickname Nickname @def index I_username Username @def unique_index I_name Name

func (*User) BatchFetchByIDList

func (user *User) BatchFetchByIDList(db *golib_tools_sqlx.DB, idList []uint64) (userList UserList, err error)

func (*User) BatchFetchByNameList

func (user *User) BatchFetchByNameList(db *golib_tools_sqlx.DB, nameList []string) (userList UserList, err error)

func (*User) BatchFetchByNicknameList

func (user *User) BatchFetchByNicknameList(db *golib_tools_sqlx.DB, nicknameList []string) (userList UserList, err error)

func (*User) BatchFetchByUsernameList

func (user *User) BatchFetchByUsernameList(db *golib_tools_sqlx.DB, usernameList []string) (userList UserList, err error)

func (*User) ConditionByStruct

func (user *User) ConditionByStruct() *golib_tools_sqlx_builder.Condition

func (*User) Create

func (user *User) Create(db *golib_tools_sqlx.DB) error

func (*User) CreateOnDuplicateWithUpdateFields

func (user *User) CreateOnDuplicateWithUpdateFields(db *golib_tools_sqlx.DB, updateFields []string) error

func (*User) D

func (user *User) D() *golib_tools_sqlx.Database

func (*User) DeleteByID

func (user *User) DeleteByID(db *golib_tools_sqlx.DB) error

func (*User) DeleteByName

func (user *User) DeleteByName(db *golib_tools_sqlx.DB) error

func (*User) DeleteByStruct

func (user *User) DeleteByStruct(db *golib_tools_sqlx.DB) (err error)

func (*User) FetchByID

func (user *User) FetchByID(db *golib_tools_sqlx.DB) error

func (*User) FetchByIDForUpdate

func (user *User) FetchByIDForUpdate(db *golib_tools_sqlx.DB) error

func (*User) FetchByName

func (user *User) FetchByName(db *golib_tools_sqlx.DB) error

func (*User) FetchByNameForUpdate

func (user *User) FetchByNameForUpdate(db *golib_tools_sqlx.DB) error

func (*User) FetchList

func (user *User) FetchList(db *golib_tools_sqlx.DB, size int32, offset int32, conditions ...*golib_tools_sqlx_builder.Condition) (userList UserList, count int32, err error)

func (*User) Fields

func (user *User) Fields() *UserFields

func (*User) IndexFieldNames

func (user *User) IndexFieldNames() []string

func (*User) Indexes

func (user *User) Indexes() golib_tools_sqlx.Indexes

func (*User) List

func (user *User) List(db *golib_tools_sqlx.DB, condition *golib_tools_sqlx_builder.Condition) (userList UserList, err error)

func (*User) ListByStruct

func (user *User) ListByStruct(db *golib_tools_sqlx.DB) (userList UserList, err error)

func (*User) PrimaryKey

func (user *User) PrimaryKey() golib_tools_sqlx.FieldNames

func (*User) SoftDeleteByID

func (user *User) SoftDeleteByID(db *golib_tools_sqlx.DB) error

func (*User) SoftDeleteByName

func (user *User) SoftDeleteByName(db *golib_tools_sqlx.DB) error

func (*User) T

func (user *User) T() *golib_tools_sqlx_builder.Table

func (*User) TableName

func (user *User) TableName() string

func (*User) UniqueIndexes

func (user *User) UniqueIndexes() golib_tools_sqlx.Indexes

func (*User) UpdateByIDWithMap

func (user *User) UpdateByIDWithMap(db *golib_tools_sqlx.DB, fieldValues golib_tools_sqlx_builder.FieldValues) error

func (*User) UpdateByIDWithStruct

func (user *User) UpdateByIDWithStruct(db *golib_tools_sqlx.DB, zeroFields ...string) error

func (*User) UpdateByNameWithMap

func (user *User) UpdateByNameWithMap(db *golib_tools_sqlx.DB, fieldValues golib_tools_sqlx_builder.FieldValues) error

func (*User) UpdateByNameWithStruct

func (user *User) UpdateByNameWithStruct(db *golib_tools_sqlx.DB, zeroFields ...string) error

type User2

type User2 struct {
	Name string `db:"F_name" json:"name" sql:"varchar(255) NOT NULL DEFAULT ''"`
}

type UserList

type UserList []User

func (*UserList) BatchFetchByIDList

func (userList *UserList) BatchFetchByIDList(db *golib_tools_sqlx.DB, idList []uint64) (err error)

deprecated

func (*UserList) BatchFetchByNameList

func (userList *UserList) BatchFetchByNameList(db *golib_tools_sqlx.DB, nameList []string) (err error)

deprecated

func (*UserList) BatchFetchByNicknameList

func (userList *UserList) BatchFetchByNicknameList(db *golib_tools_sqlx.DB, nicknameList []string) (err error)

deprecated

func (*UserList) BatchFetchByUsernameList

func (userList *UserList) BatchFetchByUsernameList(db *golib_tools_sqlx.DB, usernameList []string) (err error)

deprecated

func (*UserList) FetchList

func (userList *UserList) FetchList(db *golib_tools_sqlx.DB, size int32, offset int32, conditions ...*golib_tools_sqlx_builder.Condition) (count int32, err error)

deprecated

Jump to

Keyboard shortcuts

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