Documentation
¶
Overview ¶
Package storage - реализует чтение запись в базу всех основных сущностей, Карты, Логины, и тд.
Index ¶
- type PgStorage
- func (p *PgStorage) AddBinary(ctx context.Context, userID int64, binData models.Binary) error
- func (p *PgStorage) AddCard(ctx context.Context, userID int64, card models.Card) error
- func (p *PgStorage) AddLogin(ctx context.Context, userID int64, login models.Login) error
- func (p *PgStorage) AddText(ctx context.Context, userID int64, text models.Text) error
- func (p *PgStorage) Binary(ctx context.Context, userID int64, binID string) (*models.Binary, error)
- func (p *PgStorage) Card(ctx context.Context, userID int64, cardID string) (*models.Card, error)
- func (p *PgStorage) Close()
- func (p *PgStorage) DeleteBinary(ctx context.Context, userID int64, binID string) error
- func (p *PgStorage) DeleteCard(ctx context.Context, userID int64, cardID string) error
- func (p *PgStorage) DeleteLogin(ctx context.Context, userID int64, loginID string) error
- func (p *PgStorage) DeleteText(ctx context.Context, userID int64, textID string) error
- func (p *PgStorage) Login(ctx context.Context, userID int64, loginID string) (*models.Login, error)
- func (p *PgStorage) Register(ctx context.Context, user models.User) (int64, error)
- func (p *PgStorage) Text(ctx context.Context, userID int64, textID string) (*models.Text, error)
- func (p *PgStorage) User(ctx context.Context, login string, password string) (*models.User, error)
- func (p *PgStorage) UserByLogin(ctx context.Context, login string) (*models.User, error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PgStorage ¶
type PgStorage struct {
// contains filtered or unexported fields
}
func NewPgStorage ¶
NewPgStorage конструктор хранилища на основе postgresql, явно не используется, только через фабрику
func (*PgStorage) DeleteBinary ¶
func (*PgStorage) DeleteCard ¶
func (*PgStorage) DeleteLogin ¶
func (*PgStorage) DeleteText ¶
type Storage ¶
type Storage interface { Register(ctx context.Context, user models.User) (int64, error) UserByLogin(ctx context.Context, login string) (*models.User, error) User(ctx context.Context, login string, password string) (*models.User, error) AddCard(ctx context.Context, userID int64, card models.Card) error Card(ctx context.Context, userID int64, cardID string) (*models.Card, error) DeleteCard(ctx context.Context, userID int64, cardID string) error AddLogin(ctx context.Context, userID int64, login models.Login) error Login(ctx context.Context, userID int64, loginID string) (*models.Login, error) DeleteLogin(ctx context.Context, userID int64, loginID string) error AddText(ctx context.Context, userID int64, text models.Text) error Text(ctx context.Context, userID int64, textID string) (*models.Text, error) DeleteText(ctx context.Context, userID int64, textID string) error AddBinary(ctx context.Context, userID int64, binData models.Binary) error Binary(ctx context.Context, userID int64, binID string) (*models.Binary, error) DeleteBinary(ctx context.Context, userID int64, binID string) error Close() }
Storage описываем интерфейс для записи и чтения в бд, аналогичен HTTP API
Click to show internal directories.
Click to hide internal directories.