postgres

package
v0.0.0-...-e752ecf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePostgresConnPool

func CreatePostgresConnPool(url string) *pgxpool.Pool

Types

type GroupService

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

func NewGroupService

func NewGroupService(dbpool *pgxpool.Pool) *GroupService

func (*GroupService) CreateGroup

func (gs *GroupService) CreateGroup(c context.Context, name string) (*bbrecs.Group, error)

type GroupUserService

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

func NewGroupUserService

func NewGroupUserService(dbpool *pgxpool.Pool) *GroupUserService

func (*GroupUserService) AddUserToGroup

func (s *GroupUserService) AddUserToGroup(c context.Context, GroupID uuid.UUID, UserID uuid.UUID) error

func (*GroupUserService) GetGroupUsers

func (s *GroupUserService) GetGroupUsers(c context.Context, GroupID uuid.UUID) ([]*bbrecs.User, error)

func (*GroupUserService) RemoveUserFromGroup

func (s *GroupUserService) RemoveUserFromGroup(c context.Context, GroupID uuid.UUID, UserID uuid.UUID) error

type UserService

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

func NewUserService

func NewUserService(dbpool *pgxpool.Pool) *UserService

func (*UserService) CreateUser

func (us *UserService) CreateUser(c context.Context, user *bbrecs.User) (*bbrecs.User, error)

func (*UserService) GetUserGroups

func (us *UserService) GetUserGroups(c context.Context, userID uuid.UUID) ([]bbrecs.Group, error)

func (*UserService) GetUsers

func (us *UserService) GetUsers(c context.Context) ([]*bbrecs.User, error)

func (*UserService) UpdateUser

func (us *UserService) UpdateUser(c context.Context, userID uuid.UUID, fields bbrecs.UserUpdateFields) (*bbrecs.User, error)

TODO: pass struct with nil values so they don't get updated? Or always expect to override all columns with new values even if they are not changing

Jump to

Keyboard shortcuts

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