Documentation ¶
Index ¶
- Variables
- func NewSchemaRepository() *schemaRepository
- type BaseRepository
- func (r *BaseRepository[T]) Delete(db *xorm.Session, id string) (rowsAffected int64, err error)
- func (r *BaseRepository[T]) Get(db *xorm.Session, id string) (*T, error)
- func (r *BaseRepository[T]) Insert(db *xorm.Session, model *T) (rowsAffected int64, err error)
- func (r *BaseRepository[T]) InsertAll(db *xorm.Session, models []*T) (rowsAffected int64, err error)
- func (r *BaseRepository[T]) Update(db *xorm.Session, id string, model *T) (rowsAffected int64, err error)
- func (r *BaseRepository[T]) UpdateByMap(db *xorm.Session, id string, data map[string]any) (rowsAffected int64, err error)
- type SchemaRepository
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]) 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) }
Click to show internal directories.
Click to hide internal directories.