sql

package
v0.0.0-...-a4c28fd Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB() (*sqlx.DB, error)

func NewSQLConsumer

func NewSQLConsumer(db *sqlx.DB) *consumerSQL

NewSQLConsumer потребитель

func NewSQLProducer

func NewSQLProducer(db *sqlx.DB) *producerSQL

NewSQLProducer производитель

Types

type InSQL

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

func New

func New(db *sqlx.DB) *InSQL

New слой взаимодействия с db в данном случаи с postgresql

func (*InSQL) Balance

func (i *InSQL) Balance(ctx context.Context) (*entity.Balance, error)

Balance получение текущего баланса пользователя

func (*InSQL) BalanceAdd

func (i *InSQL) BalanceAdd(ctx context.Context, s *entity.Balance) error

BalanceAdd пополнить баланс

func (*InSQL) CardListGetUserID

func (i *InSQL) CardListGetUserID(ctx context.Context, u *entity.User) (*entity.CardList, error)

CardListGetUserID вернуть список карт по UserID

func (*InSQL) Delete

func (i *InSQL) Delete(context.Context, *entity.User) error

func (*InSQL) Get

func (i *InSQL) Get(ctx context.Context, sh *entity.Prove) (*entity.Prove, error)

func (*InSQL) GetAdmin

func (i *InSQL) GetAdmin(u *entity.User) bool

GetAdmin вернёт nil, если пользователь является админом. Админом является тот кто первый зарегистрировался.

func (*InSQL) GetAll

func (i *InSQL) GetAll(context.Context, *entity.User) (*entity.User, error)

func (*InSQL) GetAllUrls

func (i *InSQL) GetAllUrls() (entity.CountURLs, error)

func (*InSQL) GetAllUsers

func (i *InSQL) GetAllUsers() (entity.CountUsers, error)

func (*InSQL) GetBalance

func (i *InSQL) GetBalance(ctx context.Context, u *entity.SolutionData) (float64, error)

GetBalance получить информацию о кредитоспособности, если вернёт err!=nil - кредит исчерпан

func (*InSQL) GetByID

func (i *InSQL) GetByID(ctx context.Context, l string) (*entity.Authentication, error)

func (*InSQL) GetByLogin

func (i *InSQL) GetByLogin(ctx context.Context, l string) (*entity.Authentication, error)

func (*InSQL) GetSolution

func (i *InSQL) GetSolution(ctx context.Context, s *entity.SolutionData) error

GetSolution обновление баланса пользователя по его id

func (*InSQL) GroupList

func (i *InSQL) GroupList(ctx context.Context) (*entity.GroupList, error)

GroupList вернёт список групп

func (*InSQL) Post

func (i *InSQL) Post(ctx context.Context, sh *entity.Prove) error

func (*InSQL) Put

func (i *InSQL) Put(ctx context.Context, sh *entity.Prove) error

func (*InSQL) Read

func (i *InSQL) Read() error

func (*InSQL) Registry

func (i *InSQL) Registry(ctx context.Context, a *entity.Authentication) error

func (*InSQL) Save

func (i *InSQL) Save() error

func (*InSQL) SaveCard

func (i *InSQL) SaveCard(ctx context.Context, c *entity.Card) error

func (*InSQL) SaveGroup

func (i *InSQL) SaveGroup(ctx context.Context, c *entity.Group) error

func (*InSQL) SavePass

func (i *InSQL) SavePass(ctx context.Context, c *entity.Pass) error

func (*InSQL) SaveSolution

func (i *InSQL) SaveSolution(ctx context.Context, c *entity.Solution) error

func (*InSQL) SaveTask

func (i *InSQL) SaveTask(ctx context.Context, c *entity.Task) error

func (*InSQL) SaveText

func (i *InSQL) SaveText(ctx context.Context, c *entity.Text) error

func (*InSQL) TaskKey

func (i *InSQL) TaskKey(ctx context.Context, u *entity.User, t *entity.Task) (*entity.Task, error)

TaskKey вернуть одну задачу

func (*InSQL) TaskList

func (i *InSQL) TaskList(ctx context.Context) (*entity.TaskList, error)

TaskList вернёт список задач

Jump to

Keyboard shortcuts

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