demo

package
v0.0.0-...-364eef1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DemoSet = wire.NewSet(wire.Struct(new(DemoRepo), "*"))

DemoSet Injection wire

Functions

func GetDemoDB

func GetDemoDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetDemoDB Get Demo db model

Types

type Demo

type Demo struct {
	util.Model
	Code    string `gorm:"size:50;index;"`                // 编号
	Name    string `gorm:"size:50;index;"`                // 名称
	Memo    string `gorm:"size:1024;"`                    // 备注
	Status  int    `gorm:"type:tinyint;index;default:0;"` // 状态(1:启用 2:停用)
	Creator uint64 `gorm:""`                              // 创建者

}

Demo Demo entity

func (Demo) ToSchemaDemo

func (a Demo) ToSchemaDemo() *schema.Demo

ToSchemaDemo Convert to Demo schema

type DemoRepo

type DemoRepo struct {
	DB *gorm.DB
}

func (*DemoRepo) Create

func (a *DemoRepo) Create(ctx context.Context, item schema.Demo) error

func (*DemoRepo) Delete

func (a *DemoRepo) Delete(ctx context.Context, id uint64) error

func (*DemoRepo) Get

func (a *DemoRepo) Get(ctx context.Context, id uint64, opts ...schema.DemoQueryOptions) (*schema.Demo, error)

func (*DemoRepo) Query

func (*DemoRepo) Update

func (a *DemoRepo) Update(ctx context.Context, id uint64, item schema.Demo) error

func (*DemoRepo) UpdateStatus

func (a *DemoRepo) UpdateStatus(ctx context.Context, id uint64, status int) error

type Demos

type Demos []*Demo

Demos Demo entity list

func (Demos) ToSchemaDemos

func (a Demos) ToSchemaDemos() []*schema.Demo

ToSchemaDemos Convert to Demo schema list

type SchemaDemo

type SchemaDemo schema.Demo

SchemaDemo Demo schema

func (SchemaDemo) ToDemo

func (a SchemaDemo) ToDemo() *Demo

ToDemo Convert to Demo entity

Jump to

Keyboard shortcuts

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