users

package
v0.0.0-...-30666a6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const EventSource = "Users"

Variables

View Source
var (
	DisableAdvisoryLock     = false
	UseBlockingAdvisoryLock = true
)

Functions

func NewMockUserDao

func NewMockUserDao() *userDaoMock

func NewUserGRPCHandler

func NewUserGRPCHandler(service UserService, generic services.GenericService, brokerFunc func() *server.EventBroker) pb.UserServiceServer

func NewUserHandler

func NewUserHandler(user UserService, generic services.GenericService) *userHandler

func PresentUser

func PresentUser(user *User) openapi.User

Types

type ServiceLocator

type ServiceLocator func() UserService

func NewServiceLocator

func NewServiceLocator(env *environments.Env) ServiceLocator

type User

type User struct {
	api.Meta
	Username string  `json:"username"`
	Name     string  `json:"name"`
	Email    *string `json:"email"`
}

func ConvertUser

func ConvertUser(user openapi.User) *User

func (*User) BeforeCreate

func (d *User) BeforeCreate(tx *gorm.DB) error

type UserDao

type UserDao interface {
	Get(ctx context.Context, id string) (*User, error)
	Create(ctx context.Context, user *User) (*User, error)
	Replace(ctx context.Context, user *User) (*User, error)
	Delete(ctx context.Context, id string) error
	FindByIDs(ctx context.Context, ids []string) (UserList, error)
	All(ctx context.Context) (UserList, error)
}

func NewUserDao

func NewUserDao(sessionFactory *db.SessionFactory) UserDao

type UserIndex

type UserIndex map[string]*User

type UserList

type UserList []*User

func (UserList) Index

func (l UserList) Index() UserIndex

type UserPatchRequest

type UserPatchRequest struct {
	Username *string `json:"username,omitempty"`
	Name     *string `json:"name,omitempty"`
	Email    *string `json:"email,omitempty"`
}

type UserService

type UserService interface {
	Get(ctx context.Context, id string) (*User, *errors.ServiceError)
	Create(ctx context.Context, user *User) (*User, *errors.ServiceError)
	Replace(ctx context.Context, user *User) (*User, *errors.ServiceError)
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (UserList, *errors.ServiceError)

	FindByIDs(ctx context.Context, ids []string) (UserList, *errors.ServiceError)

	OnUpsert(ctx context.Context, id string) error
	OnDelete(ctx context.Context, id string) error
}

func NewUserService

func NewUserService(lockFactory db.LockFactory, userDao UserDao, events services.EventService) UserService

func Service

func Service(s *environments.Services) UserService

Jump to

Keyboard shortcuts

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