Documentation
¶
Index ¶
- Constants
- Variables
- func NewSeed() uint16
- type PgSessionRepo
- func (repo *PgSessionRepo) CreateSession(ctx context.Context, s Session) (uint64, error)
- func (repo *PgSessionRepo) GetSession(ctx context.Context, id uint64) (Session, error)
- func (repo *PgSessionRepo) GetSessionByGroupID(ctx context.Context, groupID uint64) (Session, error)
- func (repo *PgSessionRepo) UpdateShuffle(ctx context.Context, id uint64, seed uint16) error
- func (repo *PgSessionRepo) UserInSession(ctx context.Context, id uint64, email string) (bool, error)
- type Session
- type SessionService
Constants ¶
View Source
const UNIQUE_VIOLATION = "23505"
Variables ¶
View Source
var ( ErrSessionNotFound = errors.New("session not found") ErrSessionExists = errors.New("session already exists") )
Functions ¶
Types ¶
type PgSessionRepo ¶
type PgSessionRepo struct {
// contains filtered or unexported fields
}
func NewPgSessionRepo ¶
func NewPgSessionRepo(db *pgxpool.Pool) *PgSessionRepo
func (*PgSessionRepo) CreateSession ¶
func (*PgSessionRepo) GetSession ¶
func (*PgSessionRepo) GetSessionByGroupID ¶
func (repo *PgSessionRepo) GetSessionByGroupID( ctx context.Context, groupID uint64, ) (Session, error)
Get most recent session by group ID
func (*PgSessionRepo) UpdateShuffle ¶
func (*PgSessionRepo) UserInSession ¶
type Session ¶
type Session struct { ID uint64 `json:"id" db:"id"` GroupID uint64 `json:"group_id" db:"group_id"` CreateDate types.CustomTime `json:"create_date" db:"create_date"` ShuffleSeed uint16 `json:"shuffle_seed" db:"shuffle_seed"` }
func NewSession ¶
type SessionService ¶
type SessionService interface { GetSession(ctx context.Context, id uint64) (Session, error) GetSessionByGroupID(ctx context.Context, groupID uint64) (Session, error) CreateSession(ctx context.Context, s Session) (uint64, error) UpdateShuffle(ctx context.Context, id uint64, seed uint16) error UserInSession(ctx context.Context, id uint64, email string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.