Documentation ¶
Index ¶
- type Database
- func (database *Database) CreateUser(login, password string) (*User, error)
- func (database *Database) DeleteFilmByID(idStr string) error
- func (database *Database) DeleteRefreshToken(refreshToken string) error
- func (database *Database) GetAllFilms() (films []*tmdb.Film, err error)
- func (database *Database) GetCountFromCollection(nameCol string) (count int, err error)
- func (database *Database) GetFilmByID(idStr string) (film *tmdb.Film, err error)
- func (database *Database) GetFilmsByQuery(queries ...string) ([]*tmdb.Film, error)
- func (database *Database) GetUser(login string, password string) (*User, error)
- func (database *Database) GetUserByUserID(userID string) (*User, error)
- func (database *Database) InsertFilm(film *tmdb.Film) error
- func (database *Database) IsExistFilm(idStr string) (bool, error)
- func (database *Database) IsExistUser(login string) (bool, error)
- func (database *Database) UpdateRefreshTokenForUser(userID, refreshToken string) error
- func (database *Database) UpdateUser(user *User) error
- func (database *Database) UpsertFilm(film *tmdb.Film) error
- func (database *Database) UpsertUser(user *User) error
- type Overview
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Films *mgo.Collection Users *mgo.Collection }
func (*Database) CreateUser ¶
func (*Database) DeleteFilmByID ¶
func (*Database) DeleteRefreshToken ¶
func (*Database) GetAllFilms ¶
func (*Database) GetCountFromCollection ¶
func (*Database) GetFilmByID ¶
func (*Database) GetFilmsByQuery ¶
func (*Database) GetUserByUserID ¶
func (*Database) UpdateRefreshTokenForUser ¶
func (*Database) UpdateUser ¶
func (*Database) UpsertUser ¶
type User ¶
type User struct { UserID string `bson:"user_id" json:"user_id"` Login string `bson:"login" json:"login" validate:"min=3, max=10" example:"login" binding:"required"` Password string `bson:"password" json:"password" validate:"min=2, max=40" example:"password" binding:"required"` Role string `bson:"role" json:"role"` RefreshToken string `bson:"refresh_token" json:"refresh_token"` }
Click to show internal directories.
Click to hide internal directories.