Documentation ¶
Index ¶
- type Operations
- type OperationsRepository
- func (o *OperationsRepository) CreateRelationsBySegmentIDs(ctx context.Context, userId int, segmentIDs []int) ([]int, error)
- func (o *OperationsRepository) CreateRelationsBySegmentNames(ctx context.Context, userId int, segmentsNames []string) ([]int, error)
- func (o *OperationsRepository) DeleteRelationsBySegmentIDs(ctx context.Context, userId int, segmentsIDs []int) ([]int, error)
- func (o *OperationsRepository) DeleteRelationsBySegmentNames(ctx context.Context, userId int, segmentsNames []string) ([]int, error)
- func (o *OperationsRepository) GetOperations(ctx context.Context, year, month int, userIDs ...int) ([]entity.Operation, error)
- type Repositories
- type Segments
- type SegmentsRepository
- func (s *SegmentsRepository) Create(ctx context.Context, segment entity.Segment) (int, error)
- func (s *SegmentsRepository) DeleteByID(ctx context.Context, id int) error
- func (s *SegmentsRepository) DeleteByName(ctx context.Context, name string) error
- func (s *SegmentsRepository) GetActiveUsersBySegmentID(ctx context.Context, id int) ([]entity.User, error)
- func (s *SegmentsRepository) GetAll(ctx context.Context) ([]entity.Segment, error)
- func (s *SegmentsRepository) GetByID(ctx context.Context, id int) (entity.Segment, error)
- func (s *SegmentsRepository) GetByName(ctx context.Context, name string) (entity.Segment, error)
- type Users
- type UsersRepository
- func (u *UsersRepository) Create(ctx context.Context, user entity.User) (int, error)
- func (u *UsersRepository) GetActiveSegmentsByUserID(ctx context.Context, id int) ([]entity.Segment, error)
- func (u *UsersRepository) GetByCredentials(ctx context.Context, login, password string) (entity.User, error)
- func (u *UsersRepository) GetByID(ctx context.Context, id int) (entity.User, error)
- func (u *UsersRepository) GetByLogin(ctx context.Context, login string) (entity.User, error)
- func (u *UsersRepository) GetByRefreshToken(ctx context.Context, refreshToken string) (entity.User, error)
- func (u *UsersRepository) SetSession(ctx context.Context, userId int, session entity.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operations ¶
type Operations interface { CreateRelationsBySegmentIDs(ctx context.Context, userId int, segmentIDs []int) ([]int, error) CreateRelationsBySegmentNames(ctx context.Context, userId int, segmentsNames []string) ([]int, error) DeleteRelationsBySegmentIDs(ctx context.Context, userId int, segmentsIDs []int) ([]int, error) DeleteRelationsBySegmentNames(ctx context.Context, userId int, segmentsNames []string) ([]int, error) GetOperations(ctx context.Context, year, month int, userIDs ...int) ([]entity.Operation, error) }
type OperationsRepository ¶
type OperationsRepository struct {
// contains filtered or unexported fields
}
func NewOperations ¶
func NewOperations(db *sql.DB) *OperationsRepository
func (*OperationsRepository) CreateRelationsBySegmentIDs ¶
func (*OperationsRepository) CreateRelationsBySegmentNames ¶
func (*OperationsRepository) DeleteRelationsBySegmentIDs ¶
func (*OperationsRepository) DeleteRelationsBySegmentNames ¶
func (*OperationsRepository) GetOperations ¶
type Repositories ¶
type Repositories struct { Users Segments Operations }
func New ¶
func New(db *sql.DB) *Repositories
type Segments ¶
type Segments interface { Create(ctx context.Context, segment entity.Segment) (int, error) GetByName(ctx context.Context, name string) (entity.Segment, error) GetByID(ctx context.Context, id int) (entity.Segment, error) GetActiveUsersBySegmentID(ctx context.Context, id int) ([]entity.User, error) GetAll(ctx context.Context) ([]entity.Segment, error) DeleteByName(ctx context.Context, name string) error DeleteByID(ctx context.Context, id int) error }
type SegmentsRepository ¶
type SegmentsRepository struct {
// contains filtered or unexported fields
}
func NewSegments ¶
func NewSegments(db *sql.DB) *SegmentsRepository
func (*SegmentsRepository) DeleteByID ¶
func (s *SegmentsRepository) DeleteByID(ctx context.Context, id int) error
func (*SegmentsRepository) DeleteByName ¶
func (s *SegmentsRepository) DeleteByName(ctx context.Context, name string) error
func (*SegmentsRepository) GetActiveUsersBySegmentID ¶
type Users ¶
type Users interface { Create(ctx context.Context, user entity.User) (int, error) GetByID(ctx context.Context, id int) (entity.User, error) GetByLogin(ctx context.Context, login string) (entity.User, error) GetByCredentials(ctx context.Context, login, password string) (entity.User, error) GetByRefreshToken(ctx context.Context, refreshToken string) (entity.User, error) GetActiveSegmentsByUserID(ctx context.Context, id int) ([]entity.Segment, error) SetSession(ctx context.Context, userId int, session entity.Session) error }
type UsersRepository ¶
type UsersRepository struct {
// contains filtered or unexported fields
}
func NewUsers ¶
func NewUsers(db *sql.DB) *UsersRepository
func (*UsersRepository) GetActiveSegmentsByUserID ¶
func (*UsersRepository) GetByCredentials ¶
func (*UsersRepository) GetByLogin ¶
func (*UsersRepository) GetByRefreshToken ¶
func (*UsersRepository) SetSession ¶
Click to show internal directories.
Click to hide internal directories.