example

package module
v0.0.0-...-79d54f7 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla. DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla. DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGroupSQL

func NewGroupSQL() groupSQL

func NewUserExternalSQL

func NewUserExternalSQL() userExternalSQL

func NewUserItemSQL

func NewUserItemSQL() userItemSQL

func NewUserSNSSQL

func NewUserSNSSQL() userSNSSQL

func NewUserSQL

func NewUserSQL() userSQL

Types

type Group

type Group struct {
	ID              GroupID         `db:"id,primarykey,autoincrement"`
	Name            string          `db:"name"`
	LeaderUserID    UserId          `db:"leader_user_id"`
	SubLeaderUserID sql.Null[int64] `db:"sub_leader_user_id"`
	ChildGroupID    sql.Null[int64] `db:"child_group_id"`

	CreatedAt time.Time    `db:"created_at"`
	UpdatedAt sql.NullTime `db:"updated_at"`
}

func (Group) Delete

func (s Group) Delete(db sqlla.DB) (sql.Result, error)

func (Group) DeleteContext

func (s Group) DeleteContext(ctx context.Context, db sqlla.DB) (sql.Result, error)

func (*Group) Leader

func (g *Group) Leader(ctx context.Context, db sqlla.DB) (*User, error)

func (Group) Select

func (s Group) Select() groupSelectSQL

func (Group) Update

func (s Group) Update() groupUpdateSQL

type GroupID

type GroupID uint64

type GroupTable

type GroupTable struct{}

func NewGroupTable

func NewGroupTable() *GroupTable

func (*GroupTable) Create

func (g *GroupTable) Create(ctx context.Context, db sqlla.DB, input GroupTableCreateInput) (*Group, error)

func (*GroupTable) CreateMulti

func (g *GroupTable) CreateMulti(ctx context.Context, db sqlla.DB, inputs []GroupTableCreateInput) error

func (*GroupTable) GetByID

func (g *GroupTable) GetByID(ctx context.Context, db sqlla.DB, c0 GroupID) (*Group, error)

func (*GroupTable) GetByIDAndLeaderUserID

func (g *GroupTable) GetByIDAndLeaderUserID(ctx context.Context, db sqlla.DB, c0 GroupID, c1 UserId) (*Group, error)

func (*GroupTable) ListByIDS

func (g *GroupTable) ListByIDS(ctx context.Context, db sqlla.DB, cs []GroupID) (Groups, error)

func (*GroupTable) ListByLeaderUserIDAndSubLeaderUserID

func (g *GroupTable) ListByLeaderUserIDAndSubLeaderUserID(ctx context.Context, db sqlla.DB, c0 UserId, c1 int64) (Groups, error)

type GroupTableCreateInput

type GroupTableCreateInput struct {
	Name            string
	LeaderUserID    UserId
	SubLeaderUserID sql.Null[int64]
	ChildGroupID    sql.Null[int64]
	CreatedAt       time.Time
}

type Groups

type Groups []*Group

type User

type User struct {
	Id        UserId         `db:"id,primarykey,autoincrement"`
	Name      string         `db:"name"`
	Age       sql.NullInt64  `db:"age"`
	Rate      float64        `db:"rate,default=0"`
	IconImage []byte         `db:"icon_image"`
	CreatedAt time.Time      `db:"created_at"`
	UpdatedAt mysql.NullTime `db:"updated_at"`
}

+table: user

func (User) DefaultInsertHook

func (u User) DefaultInsertHook(_q userInsertSQL) (userInsertSQL, error)

func (User) DefaultInsertOnDuplicateKeyUpdateHook

func (u User) DefaultInsertOnDuplicateKeyUpdateHook(_q userInsertOnDuplicateKeyUpdateSQL) (userInsertOnDuplicateKeyUpdateSQL, error)

func (User) DefaultUpdateHook

func (u User) DefaultUpdateHook(q userUpdateSQL) (userUpdateSQL, error)

func (User) Delete

func (s User) Delete(db sqlla.DB) (sql.Result, error)

func (User) DeleteContext

func (s User) DeleteContext(ctx context.Context, db sqlla.DB) (sql.Result, error)

func (User) Select

func (s User) Select() userSelectSQL

func (User) Update

func (s User) Update() userUpdateSQL

type UserExternal

type UserExternal struct {
	Id        uint64    `db:"id,primarykey"`
	UserId    uint64    `db:"user_id"`
	IconImage []byte    `db:"icon_image,null"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

+table: user_external

func (UserExternal) Delete

func (s UserExternal) Delete(db sqlla.DB) (sql.Result, error)

func (UserExternal) DeleteContext

func (s UserExternal) DeleteContext(ctx context.Context, db sqlla.DB) (sql.Result, error)

func (UserExternal) Select

func (s UserExternal) Select() userExternalSelectSQL

func (UserExternal) Update

func (s UserExternal) Update() userExternalUpdateSQL

type UserId

type UserId uint64

type UserItem

type UserItem struct {
	Id           uint64       `db:"id,primarykey,autoincrement"`
	UserId       uint64       `db:"user_id"`
	ItemId       string       `db:"item_id"`
	IsUsed       bool         `db:"is_used"`
	HasExtension sql.NullBool `db:"has_extension"`
	UsedAt       sql.NullTime `db:"used_at"`
}

+table: user_item

func (UserItem) Delete

func (s UserItem) Delete(db sqlla.DB) (sql.Result, error)

func (UserItem) DeleteContext

func (s UserItem) DeleteContext(ctx context.Context, db sqlla.DB) (sql.Result, error)

func (UserItem) Select

func (s UserItem) Select() userItemSelectSQL

func (UserItem) Update

func (s UserItem) Update() userItemUpdateSQL

type UserSNS

type UserSNS struct {
	ID        uint64    `db:"id,primarykey"`
	SNSType   string    `db:"sns_type"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

+table: user_sns

func (UserSNS) Delete

func (s UserSNS) Delete(db sqlla.DB) (sql.Result, error)

func (UserSNS) DeleteContext

func (s UserSNS) DeleteContext(ctx context.Context, db sqlla.DB) (sql.Result, error)

func (UserSNS) Select

func (s UserSNS) Select() userSNSSelectSQL

func (UserSNS) Update

func (s UserSNS) Update() userSNSUpdateSQL

type Users

type Users []*User

func (Users) AssociateByIds

func (u Users) AssociateByIds() map[UserId]*User

func (Users) GroupByNames

func (u Users) GroupByNames() map[string]Users

func (Users) Ids

func (u Users) Ids() []UserId

func (Users) Names

func (u Users) Names() []string

Directories

Path Synopsis
Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.
Code generated by github.com/mackee/go-sqlla/v2/cmd/sqlla - DO NOT EDIT.

Jump to

Keyboard shortcuts

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