dao

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 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 Order added in v0.3.0

type Order struct {
	ID        int64     `xorm:"pk autoincr"`
	UserID    string    `xorm:"not null"`
	Amount    float64   `xorm:"not null"`
	Status    string    `xorm:"not null default 'pending'"`
	CreatedAt time.Time `xorm:"created"`
}

Order 订单模型

type OrderDao added in v0.3.0

type OrderDao struct{}

OrderDao 订单DAO

func NewOrderDao added in v0.3.0

func NewOrderDao() *OrderDao

NewOrderDao 创建订单DAO

func (*OrderDao) BatchSync added in v0.3.0

func (d *OrderDao) BatchSync(ctx context.IContext) error

BatchSync 批量同步数据(跨表操作示例)

func (*OrderDao) CreateOrderWithItems added in v0.3.0

func (d *OrderDao) CreateOrderWithItems(ctx context.IContext, userID string, items []OrderItem) (*Order, error)

CreateOrderWithItems 创建订单及订单项(跨表事务示例) 这是使用新的 BeginTx 方法的完整示例

func (*OrderDao) SyncTables added in v0.3.0

func (d *OrderDao) SyncTables() error

SyncTables 同步表结构(演示使用)

type OrderItem added in v0.3.0

type OrderItem struct {
	ID       int64   `xorm:"pk autoincr"`
	OrderID  int64   `xorm:"not null"`
	Product  string  `xorm:"not null"`
	Quantity int     `xorm:"not null"`
	Price    float64 `xorm:"not null"`
}

OrderItem 订单项模型

type Test0

type Test0 struct {
	ID        int64     `xorm:"not null pk autoincr BIGINT(20) id"`
	CreatedAt time.Time `xorm:"created not null default CURRENT_TIMESTAMP TIMESTAMP created_at"`
	UpdatedAt time.Time `xorm:"updated_at TIMESTAMP"`
	UserID    string    `xorm:"not null default 0 BIGINT(20) INDEX user_id"`
}

type Test1

type Test1 struct {
	ID     string `xorm:"not null pk autoincr BIGINT(20) id"`
	UserID string `xorm:"not null default 0 BIGINT(20) INDEX user_id"`
}

type Test2

type Test2 struct {
	ID        int64     `xorm:"not null pk autoincr BIGINT(20) id"`
	CreatedAt time.Time `xorm:"created not null default CURRENT_TIMESTAMP TIMESTAMP created_at"`
	UpdatedAt time.Time `xorm:"updated_at TIMESTAMP"`
}

type TestDbDao

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

func NewTestDbDao

func NewTestDbDao() *TestDbDao

NewTestDbDao

func (*TestDbDao) Info

func (m *TestDbDao) Info(ctx context.IContext, ID int64) (*Test0, bool, error)

func (*TestDbDao) Sync

func (m *TestDbDao) Sync(ctx context.IContext) error

Jump to

Keyboard shortcuts

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