Documentation
¶
Index ¶
- func GetKeyExampleMysqlService(ns ...string) string
- func RegisterKeyExampleMysqlService(ctx frame.ContextCommander, ns ...string) string
- type ExampleMysqlService
- func (s *ExampleMysqlService) AutoMigrate() error
- func (s *ExampleMysqlService) BatchCreateUsers(ctx context.Context, users []entity.User) error
- func (s *ExampleMysqlService) BatchDeleteUsers(ctx context.Context, ids []uint) error
- func (s *ExampleMysqlService) CreateUser(ctx context.Context, user *entity.User) error
- func (s *ExampleMysqlService) CreateUserWithClasses(ctx context.Context, user *entity.User, classes []entity.Class) error
- func (s *ExampleMysqlService) DeleteUser(ctx context.Context, id uint) error
- func (s *ExampleMysqlService) GetUserByID(ctx context.Context, id uint) (*entity.User, error)
- func (s *ExampleMysqlService) GetUsersByName(ctx context.Context, name string) ([]entity.User, error)
- func (s *ExampleMysqlService) HardDeleteUser(ctx context.Context, id uint) error
- func (s *ExampleMysqlService) ListUsers(ctx context.Context, page, size int, nameLike string) ([]entity.User, int64, error)
- func (s *ExampleMysqlService) TestOk() string
- func (s *ExampleMysqlService) TestOrm(ctx frame.ContextCommander, op string, id uint) error
- func (s *ExampleMysqlService) UpdateUser(ctx context.Context, id uint, updates map[string]interface{}) error
- func (s *ExampleMysqlService) UpdateUserStruct(ctx context.Context, user *entity.User) error
- type MongodbService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeyExampleMysqlService ¶
GetKeyExampleMysqlService 定义和获取 ExampleMysqlService 注册到全局管理器的实例key
func RegisterKeyExampleMysqlService ¶
func RegisterKeyExampleMysqlService(ctx frame.ContextCommander, ns ...string) string
RegisterKeyExampleMysqlService 注册 ExampleMysqlService 到全局管理器,并返回注册实例key
Types ¶
type ExampleMysqlService ¶
type ExampleMysqlService struct {
frame.ServiceLocator
Model *model.ExampleMysqlModel
}
func NewExampleMysqlService ¶
func NewExampleMysqlService(ctx frame.ContextCommander, m *model.ExampleMysqlModel) *ExampleMysqlService
func (*ExampleMysqlService) AutoMigrate ¶
func (s *ExampleMysqlService) AutoMigrate() error
AutoMigrate 自动创建数据库表结构
func (*ExampleMysqlService) BatchCreateUsers ¶
BatchCreateUsers 批量创建用户
func (*ExampleMysqlService) BatchDeleteUsers ¶
func (s *ExampleMysqlService) BatchDeleteUsers(ctx context.Context, ids []uint) error
BatchDeleteUsers 批量删除用户
func (*ExampleMysqlService) CreateUser ¶
CreateUser 创建用户
func (*ExampleMysqlService) CreateUserWithClasses ¶
func (s *ExampleMysqlService) CreateUserWithClasses(ctx context.Context, user *entity.User, classes []entity.Class) error
CreateUserWithClasses 创建用户并关联班级(事务)
func (*ExampleMysqlService) DeleteUser ¶
func (s *ExampleMysqlService) DeleteUser(ctx context.Context, id uint) error
DeleteUser 软删除用户
func (*ExampleMysqlService) GetUserByID ¶
GetUserByID 根据ID获取用户
func (*ExampleMysqlService) GetUsersByName ¶
func (s *ExampleMysqlService) GetUsersByName(ctx context.Context, name string) ([]entity.User, error)
GetUsersByName 根据名称获取用户列表
func (*ExampleMysqlService) HardDeleteUser ¶
func (s *ExampleMysqlService) HardDeleteUser(ctx context.Context, id uint) error
HardDeleteUser 硬删除用户
func (*ExampleMysqlService) ListUsers ¶
func (s *ExampleMysqlService) ListUsers(ctx context.Context, page, size int, nameLike string) ([]entity.User, int64, error)
ListUsers 分页查询用户列表
func (*ExampleMysqlService) TestOrm ¶
func (s *ExampleMysqlService) TestOrm(ctx frame.ContextCommander, op string, id uint) error
TestOrm 测试ORM
func (*ExampleMysqlService) UpdateUser ¶
func (s *ExampleMysqlService) UpdateUser(ctx context.Context, id uint, updates map[string]interface{}) error
UpdateUser 更新用户信息
func (*ExampleMysqlService) UpdateUserStruct ¶
UpdateUserStruct 通过结构体更新用户
type MongodbService ¶
type MongodbService struct {
*frame.Service
MongoModel *model.MongodbModel
}
func NewMongodbService ¶
func NewMongodbService(ctx frame.ContextCommander, mongodbModel *model.MongodbModel) *MongodbService
func (*MongodbService) Test ¶
func (s *MongodbService) Test() error
Click to show internal directories.
Click to hide internal directories.