repository

package
v0.0.0-...-03ce398 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USERS_LIMIT     = 30
	USERS_TABLENAME = "users"
)
View Source
const (
	JOKES_TABLENAME = "jokes"
)
View Source
const (
	STATES_TABLENAME = "states"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateStateDto

type CreateStateDto struct {
	Id      uuid.UUID `db:"id"`
	Name    string    `db:"name"`
	Context string    `db:"context"`
}

type CreateUserDto

type CreateUserDto struct {
	Id      uuid.UUID    `db:"id"`
	Name    string       `db:"name"`
	Login   string       `db:"login"`
	ChatId  types.ChatId `db:"chat_id"`
	StateId uuid.UUID    `db:"state_id"`
}

type JokeDb

type JokeDb struct {
	Id          uuid.UUID      `db:"id"`
	Name        sql.NullString `db:"name"`
	Text        sql.NullString `db:"text"`
	Author      sql.NullString `db:"author"`
	Explanation sql.NullString `db:"explanation"`
}

type JokeDbDto

type JokeDbDto struct {
	Id          uuid.UUID
	Name        string
	Text        string
	Author      string
	Explanation string
}

func JokeDbToJokeDbDto

func JokeDbToJokeDbDto(jokeDb JokeDb) JokeDbDto

type JokeQuery

type JokeQuery struct {
	Offset int
}

type JokeRepository

type JokeRepository interface {
	Add(interface{}) (uuid.UUID, error)
	Remove(interface{})
	Edit(interface{})
	GetList(interface{})
	Count(interface{}) (int, error)
	GetOne(JokeQuery) (JokeDbDto, error)
	UpdateContext(uuid.UUID, string) error
}

type Repository

type Repository struct {
	Conn            *sqlx.DB
	UserRepository  UserRepository
	StateRepository StateRepository
	JokeRepository  JokeRepository
}

func (*Repository) Close

func (repo *Repository) Close()

type StateDbDto

type StateDbDto struct {
	Id      uuid.UUID
	Name    string
	Context string
}

type StateRepository

type StateRepository interface {
	Add(query CreateStateDto) (uuid.UUID, error)
	Remove(interface{})
	Edit(interface{})
	GetList(interface{})
}

type UserDb

type UserDb struct {
	Id      uuid.UUID      `db:"id"`
	Name    sql.NullString `db:"name"`
	Login   sql.NullString `db:"login"`
	ChatId  types.ChatId   `db:"chat_id"`
	StateId uuid.UUID      `db:"state_id"`
	State   StateDbDto     `db:"state"`
}

type UserDbDto

type UserDbDto struct {
	Id      uuid.UUID
	Name    string
	Login   string
	ChatId  types.ChatId
	StateId uuid.UUID
	State   StateDbDto
}

func UserDbToUserDbDto

func UserDbToUserDbDto(userDb UserDb) UserDbDto

type UserListQuery

type UserListQuery struct {
	Pagination utils.QueryPagination
	Name       string
	State      string
}

type UserQuery

type UserQuery struct {
	Login  string
	ChatId types.ChatId
}

type UserRepository

type UserRepository interface {
	Add(query CreateUserDto) (uuid.UUID, error)
	Remove(interface{})
	Edit(interface{})
	GetList(query UserListQuery) UsersDbMetaDto
	GetOne(query UserQuery) (UserDbDto, error)
	SetNewStateUUID(userUUID uuid.UUID, stateUUID uuid.UUID) error
}

type UsersDbMetaDto

type UsersDbMetaDto struct {
	Data []UserDbDto
	Meta utils.Pagination
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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