database

package
v0.0.0-...-4f1325e Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID uint `gorm:"AUTO_INCREMENT"`
}

BaseModel 模型基类

type Mock

type Mock struct {
	BaseModel
	Name string
}

func (Mock) TableName

func (Mock) TableName() string

type Repo

type Repo interface {
	CreateMock(model *Mock) (id uint, err error)
	GetMockById(id uint) (model *Mock, err error)
	ListMocksByCondition(req *request.ListRequest) (r []*response.ListData, count int64, err error)
	UpdateMockById(id uint, m map[string]interface{}) error
	DeleteMockById(id uint) error
}

定义Database查询接口

func New

func New(zapLogger *zap.Logger) (repo Repo, err error)

Connect 连接数据库

Jump to

Keyboard shortcuts

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