Documentation ¶
Index ¶
- Constants
- type DB
- type Store
- func (s *Store) CreateAssignment(ctx context.Context, request model.SendQuestRequest) error
- func (s *Store) DeleteQuest(ctx context.Context, id string) error
- func (s *Store) GetAssignment(ctx context.Context, questId string, userId string) (*model.Assignment, error)
- func (s *Store) GetQuest(ctx context.Context, id string) (*model.QuestWithSteps, error)
- func (s *Store) GetQuestsAvailable(ctx context.Context, email string, offset int, limit int, finished bool) ([]model.QuestAvailable, *model.Meta, error)
- func (s *Store) GetQuestsByUser(ctx context.Context, uuid string, offset int, limit int) ([]model.Quest, *model.Meta, error)
- func (s *Store) GetRecipients(ctx context.Context, ownerId string, questId string) ([]model.Recipient, error)
- func (s *Store) InsertQuest(ctx context.Context, quest *model.QuestWithSteps) (*model.QuestWithSteps, error)
- func (s *Store) UpdateAssignment(ctx context.Context, questId string, userId *string, currentStep int, ...) error
- func (s *Store) UpdateQuest(ctx context.Context, quest *model.QuestWithSteps) (*model.QuestWithSteps, error)
Constants ¶
View Source
const ( // ErrInvalidEmail is returned when the email is not a valid address or is empty. ErrInvalidEmail = errors.Error("invalid_email: email is invalid") // ErrQuestAlreadySentToEmail is returned when the email address is already used via another user. ErrQuestAlreadySentToEmail = errors.Error("Quest is already sent to this email") // ErrEmptyNickname is returned when the nickname is empty. ErrEmptyNickname = errors.Error("empty_nickname: nickname is empty") // ErrNicknameAlreadyUsed is returned when the nickname is already used via another user. ErrNicknameAlreadyUsed = errors.Error("nickname_already_used: nickname is already in use") // ErrEmptyPassword is returned when the password is empty. ErrEmptyPassword = errors.Error("empty_password: password is empty") // ErrInvalidID si returned when the ID is not a valid UUID or is empty. ErrInvalidID = errors.Error("invalid_id: id is invalid") ErrQuestAlreadySent = errors.Error("Нельзя удалить квест, отправленый другу!") ErrQuestNotDeleted = errors.Error("quest not deleted") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { NamedQueryContext(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error) }
DB represents a type for interfacing with database.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides functionality for working with a database.
func (*Store) CreateAssignment ¶
func (*Store) GetAssignment ¶
func (*Store) GetQuestsAvailable ¶
func (*Store) GetQuestsByUser ¶
func (s *Store) GetQuestsByUser(ctx context.Context, uuid string, offset int, limit int) ([]model.Quest, *model.Meta, error)
GetQuestsByUser will get quests created by user
func (*Store) GetRecipients ¶
func (*Store) InsertQuest ¶
func (s *Store) InsertQuest(ctx context.Context, quest *model.QuestWithSteps) (*model.QuestWithSteps, error)
InsertQuest will add a new quest to the database using the provided data.
func (*Store) UpdateAssignment ¶
func (*Store) UpdateQuest ¶
func (s *Store) UpdateQuest(ctx context.Context, quest *model.QuestWithSteps) (*model.QuestWithSteps, error)
Click to show internal directories.
Click to hide internal directories.