service

package
v0.0.0-...-2c51fd6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CountUserCacheKey = "count_user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentRepo

type ComponentRepo interface {
	Get(ctx context.Context, id string) (*domain.Component, error)
	Create(ctx context.Context, component *domain.Component) (string, error)
	Update(ctx context.Context, id string, component *domain.Component) error
	Query(ctx context.Context, filter *domain.ComponentFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.Component, int32, error)
	QueryDependency(ctx context.Context, id string, filter *domain.ComponentFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.Component, int32, error)
	QueryDependents(ctx context.Context, id string, filter *domain.ComponentFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.Component, int32, error)
	QueryTags(ctx context.Context) ([]string, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(config *config.Server, logger *zap.Logger,
	componentRepo ComponentRepo,
	transaction Transaction,
	userRepo UserRepo,
	teamRepo TeamRepo,
) (*Service, error)

func (*Service) CreateComponent

func (service *Service) CreateComponent(ctx context.Context) (string, error)

func (*Service) CreateUser

func (service *Service) CreateUser(ctx context.Context, user *domain.User) (*domain.User, error)

func (*Service) GetUserByGithubID

func (service *Service) GetUserByGithubID(ctx context.Context, githubID string) (*domain.User, error)

type TeamRepo

type TeamRepo interface {
	Create(ctx context.Context, team *domain.Team) (string, error)
	Get(ctx context.Context, id string) (*domain.Team, error)
	Delete(ctx context.Context, id string) error
	Update(ctx context.Context, id string, team *domain.Team) error
	Query(ctx context.Context, filter *domain.TeamFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.Team, int32, error)
	QueryMember(ctx context.Context, id string, filter *domain.UserFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.User, int32, error)
}

type Transaction

type Transaction interface {
	InTx(context.Context, func(ctx context.Context) error) error
}

type UserRepo

type UserRepo interface {
	Query(ctx context.Context, filter *domain.UserFilter, page *domain.PageQuery, sort []*domain.SortQuery) ([]*domain.User, int32, error)
	Create(ctx context.Context, user *domain.User) (*domain.User, error)
	Get(ctx context.Context, id string) (*domain.User, error)
	Delete(ctx context.Context, id string) error
	Update(ctx context.Context, id string, user *domain.User) error
	GetByGithubID(ctx context.Context, githubID string) (*domain.User, error)
	Count(ctx context.Context) (int32, error)
}

Jump to

Keyboard shortcuts

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