repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(
	NewSchemaRepository, wire.Bind(new(SchemaRepository), new(*schemaRepository)),
)

ProviderSet is repository providers.

Functions

func NewSchemaRepository

func NewSchemaRepository() *schemaRepository

Types

type BaseRepository

type BaseRepository[T any] struct{}

func (*BaseRepository[T]) Delete

func (r *BaseRepository[T]) Delete(db *xorm.Session, id string) (rowsAffected int64, err error)

Delete 删除

func (*BaseRepository[T]) Get

func (r *BaseRepository[T]) Get(db *xorm.Session, id string) (*T, error)

Get 获取模型

func (*BaseRepository[T]) Insert

func (r *BaseRepository[T]) Insert(db *xorm.Session, model *T) (rowsAffected int64, err error)

Insert 新增

func (*BaseRepository[T]) InsertAll

func (r *BaseRepository[T]) InsertAll(db *xorm.Session, models []*T) (rowsAffected int64, err error)

InsertAll 新增

func (*BaseRepository[T]) Update

func (r *BaseRepository[T]) Update(db *xorm.Session, id string, model *T) (rowsAffected int64, err error)

Update 更新模型

func (*BaseRepository[T]) UpdateByMap

func (r *BaseRepository[T]) UpdateByMap(db *xorm.Session, id string, data map[string]any) (rowsAffected int64, err error)

UpdateByMap 按需更新模型

type SchemaRepository

type SchemaRepository interface {
	Insert(db *xorm.Session, schema *model.Schema) (rowsAffected int64, err error)
	Update(db *xorm.Session, id string, schema *model.Schema) (rowsAffected int64, err error)
	UpdateByMap(db *xorm.Session, id string, data map[string]any) (rowsAffected int64, err error)
	Delete(db *xorm.Session, id string) (rowsAffected int64, err error)
	Get(db *xorm.Session, id string) (*model.Schema, error)
	GetSchema(db *xorm.Session, dbName, tableName string) (map[string]*model.Schema, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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