service

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyExampleMysqlService

func GetKeyExampleMysqlService(ns ...string) string

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 (*ExampleMysqlService) AutoMigrate

func (s *ExampleMysqlService) AutoMigrate() error

AutoMigrate 自动创建数据库表结构

func (*ExampleMysqlService) BatchCreateUsers

func (s *ExampleMysqlService) BatchCreateUsers(ctx context.Context, users []entity.User) error

BatchCreateUsers 批量创建用户

func (*ExampleMysqlService) BatchDeleteUsers

func (s *ExampleMysqlService) BatchDeleteUsers(ctx context.Context, ids []uint) error

BatchDeleteUsers 批量删除用户

func (*ExampleMysqlService) CreateUser

func (s *ExampleMysqlService) CreateUser(ctx context.Context, user *entity.User) error

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

func (s *ExampleMysqlService) GetUserByID(ctx context.Context, id uint) (*entity.User, error)

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) TestOk

func (s *ExampleMysqlService) TestOk() string

TestOk 测试服务是否可用

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

func (s *ExampleMysqlService) UpdateUserStruct(ctx context.Context, user *entity.User) error

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

Jump to

Keyboard shortcuts

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