example

package
v1.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB = sqlx.NewDatabase("test")
View Source
var OrgTable *builder.Table
View Source
var UserTable *builder.Table

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 GeomString

type GeomString struct {
	V string
}

func (GeomString) DataType

func (GeomString) DataType(driverName string) string

func (*GeomString) Scan

func (g *GeomString) Scan(src interface{}) error

func (GeomString) Value

func (g GeomString) Value() (driver.Value, error)

func (GeomString) ValueEx

func (GeomString) ValueEx() string

type Org

type Org struct {
	ID   uint64 `db:"f_id,autoincrement"`
	Name string `db:"f_name,default=''"`
	// @rel User.ID
	// User relation...
	UserID string `db:"f_user_id"`
}

Org describe organization information

func (*Org) ColDesc

func (*Org) ColDesc() map[string][]string

func (*Org) ColID

func (m *Org) ColID() *builder.Column

func (*Org) ColName

func (m *Org) ColName() *builder.Column

func (*Org) ColRel

func (*Org) ColRel() map[string][]string

func (*Org) ColUserID

func (m *Org) ColUserID() *builder.Column

func (*Org) Comments

func (*Org) Comments() map[string]string

func (*Org) CondByValue

func (m *Org) CondByValue(db sqlx.DBExecutor) builder.SqlCondition

func (*Org) Count

func (m *Org) Count(db sqlx.DBExecutor, cond builder.SqlCondition, adds ...builder.Addition) (cnt int64, err error)

func (*Org) Create

func (m *Org) Create(db sqlx.DBExecutor) error

func (*Org) Delete

func (m *Org) Delete(db sqlx.DBExecutor) error

func (*Org) DeleteByID

func (m *Org) DeleteByID(db sqlx.DBExecutor) error

func (*Org) FetchByID

func (m *Org) FetchByID(db sqlx.DBExecutor) error

func (*Org) FieldID

func (*Org) FieldID() string

func (*Org) FieldName

func (*Org) FieldName() string

func (*Org) FieldUserID

func (*Org) FieldUserID() string

func (*Org) IndexFieldNames

func (m *Org) IndexFieldNames() []string

func (*Org) List

func (m *Org) List(db sqlx.DBExecutor, cond builder.SqlCondition, adds ...builder.Addition) ([]Org, error)

func (*Org) PrimaryKey

func (*Org) PrimaryKey() []string

func (*Org) TableDesc

func (*Org) TableDesc() []string

func (*Org) TableName

func (*Org) TableName() string

func (*Org) UpdateByID

func (m *Org) UpdateByID(db sqlx.DBExecutor, zeros ...string) error

func (*Org) UpdateByIDWithFVs

func (m *Org) UpdateByIDWithFVs(db sqlx.DBExecutor, fvs builder.FieldValues) error

type OrgIterator

type OrgIterator struct {
}

func (*OrgIterator) New

func (*OrgIterator) New() interface{}

func (*OrgIterator) Resolve

func (*OrgIterator) Resolve(v interface{}) *Org

type User

type User struct {
	ID uint64 `db:"f_id,autoincrement"`

	Name     string     `db:"f_name,default=''"`     // 姓名
	Nickname string     `db:"f_nickname,default=''"` // 昵称
	Username string     `db:"f_username,default=''"` // 用户名
	Gender   Gender     `db:"f_gender,default='0'"`
	Boolean  bool       `db:"f_boolean,default=false"`
	Geom     GeomString `db:"f_geom"`
	// @rel Org.ID
	// 关联组织
	// 组织ID
	OrgID     uint64          `db:"f_org_id"`
	CreatedAt types.Timestamp `db:"f_created_at,default='0'"`
	UpdatedAt types.Timestamp `db:"f_updated_at,default='0'"`
	DeletedAt types.Timestamp `db:"f_deleted_at,default='0'"`
}

User 用户表

func (*User) ColBoolean

func (m *User) ColBoolean() *builder.Column

func (*User) ColCreatedAt

func (m *User) ColCreatedAt() *builder.Column

func (*User) ColDeletedAt

func (m *User) ColDeletedAt() *builder.Column

func (*User) ColDesc

func (*User) ColDesc() map[string][]string

func (*User) ColGender

func (m *User) ColGender() *builder.Column

func (*User) ColGeom

func (m *User) ColGeom() *builder.Column

func (*User) ColID

func (m *User) ColID() *builder.Column

func (*User) ColName

func (m *User) ColName() *builder.Column

func (*User) ColNickname

func (m *User) ColNickname() *builder.Column

func (*User) ColOrgID

func (m *User) ColOrgID() *builder.Column

func (*User) ColRel

func (*User) ColRel() map[string][]string

func (*User) ColUpdatedAt

func (m *User) ColUpdatedAt() *builder.Column

func (*User) ColUsername

func (m *User) ColUsername() *builder.Column

func (*User) Comments

func (*User) Comments() map[string]string

func (*User) CondByValue

func (m *User) CondByValue(db sqlx.DBExecutor) builder.SqlCondition

func (*User) Count

func (m *User) Count(db sqlx.DBExecutor, cond builder.SqlCondition, adds ...builder.Addition) (cnt int64, err error)

func (*User) Create

func (m *User) Create(db sqlx.DBExecutor) error

func (*User) Delete

func (m *User) Delete(db sqlx.DBExecutor) error

func (*User) DeleteByID

func (m *User) DeleteByID(db sqlx.DBExecutor) error

func (*User) DeleteByIDAndOrgID

func (m *User) DeleteByIDAndOrgID(db sqlx.DBExecutor) error

func (*User) DeleteByName

func (m *User) DeleteByName(db sqlx.DBExecutor) error

func (*User) FetchByID

func (m *User) FetchByID(db sqlx.DBExecutor) error

func (*User) FetchByIDAndOrgID

func (m *User) FetchByIDAndOrgID(db sqlx.DBExecutor) error

func (*User) FetchByName

func (m *User) FetchByName(db sqlx.DBExecutor) error

func (*User) FieldBoolean

func (*User) FieldBoolean() string

func (*User) FieldCreatedAt

func (*User) FieldCreatedAt() string

func (*User) FieldDeletedAt

func (*User) FieldDeletedAt() string

func (*User) FieldGender

func (*User) FieldGender() string

func (*User) FieldGeom

func (*User) FieldGeom() string

func (*User) FieldID

func (*User) FieldID() string

func (*User) FieldName

func (*User) FieldName() string

func (*User) FieldNickname

func (*User) FieldNickname() string

func (*User) FieldOrgID

func (*User) FieldOrgID() string

func (*User) FieldUpdatedAt

func (*User) FieldUpdatedAt() string

func (*User) FieldUsername

func (*User) FieldUsername() string

func (*User) IndexFieldNames

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

func (*User) Indexes

func (*User) Indexes() builder.Indexes

func (*User) List

func (m *User) List(db sqlx.DBExecutor, cond builder.SqlCondition, adds ...builder.Addition) ([]User, error)

func (*User) PrimaryKey

func (*User) PrimaryKey() []string

func (*User) SoftDeleteByID

func (m *User) SoftDeleteByID(db sqlx.DBExecutor) error

func (*User) SoftDeleteByIDAndOrgID

func (m *User) SoftDeleteByIDAndOrgID(db sqlx.DBExecutor) error

func (*User) SoftDeleteByName

func (m *User) SoftDeleteByName(db sqlx.DBExecutor) error

func (*User) TableDesc

func (*User) TableDesc() []string

func (*User) TableName

func (*User) TableName() string

func (*User) UniqueIndexUIIDOrg

func (*User) UniqueIndexUIIDOrg() string

func (*User) UniqueIndexUIName

func (*User) UniqueIndexUIName() string

func (*User) UniqueIndexes

func (*User) UniqueIndexes() builder.Indexes

func (*User) UpdateByID

func (m *User) UpdateByID(db sqlx.DBExecutor, zeros ...string) error

func (*User) UpdateByIDAndOrgID

func (m *User) UpdateByIDAndOrgID(db sqlx.DBExecutor, zeros ...string) error

func (*User) UpdateByIDAndOrgIDWithFVs

func (m *User) UpdateByIDAndOrgIDWithFVs(db sqlx.DBExecutor, fvs builder.FieldValues) error

func (*User) UpdateByIDWithFVs

func (m *User) UpdateByIDWithFVs(db sqlx.DBExecutor, fvs builder.FieldValues) error

func (*User) UpdateByName

func (m *User) UpdateByName(db sqlx.DBExecutor, zeros ...string) error

func (*User) UpdateByNameWithFVs

func (m *User) UpdateByNameWithFVs(db sqlx.DBExecutor, fvs builder.FieldValues) error

type UserIterator

type UserIterator struct {
}

func (*UserIterator) New

func (*UserIterator) New() interface{}

func (*UserIterator) Resolve

func (*UserIterator) Resolve(v interface{}) *User

Jump to

Keyboard shortcuts

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