Documentation ¶
Index ¶
- type Auth
- type AuthClaims
- type AuthJWT
- type Conn
- func (c *Conn) Attach(ctx context.Context, s map[int64][]int, pivot string) error
- func (c *Conn) Authenticate(ctx context.Context, email string) (string, error)
- func (c *Conn) CreateGenre(ctx context.Context, g *Genre) error
- func (c *Conn) CreateKeyword(ctx context.Context, k *Keyword) error
- func (c *Conn) CreateRecommendation(ctx context.Context, r *Recommendation) (int64, error)
- func (c *Conn) CreateRecommendationItem(ctx context.Context, r *RecommendationItem) (int64, error)
- func (c *Conn) CreateSource(ctx context.Context, s *Source) error
- func (c *Conn) CreateUser(ctx context.Context, u *User) error
- func (c *Conn) DeleteGenre(ctx context.Context, id int64) error
- func (c *Conn) DeleteKeyword(ctx context.Context, id int64) error
- func (c *Conn) DeleteRecommendation(ctx context.Context, id int64) error
- func (c *Conn) DeleteRecommendationItem(ctx context.Context, id int64) error
- func (c *Conn) DeleteSource(ctx context.Context, id int64) error
- func (c *Conn) DeleteUser(ctx context.Context, id int64) error
- func (c *Conn) Detach(ctx context.Context, s map[int64][]int, pivot, field string) error
- func (c *Conn) GetAuthenticationInfo(ctx context.Context, email string) (*Auth, error)
- func (c *Conn) GetGenre(ctx context.Context, id int64) (*Genre, error)
- func (c *Conn) GetGenres(ctx context.Context, limit int) (*GenreResult, error)
- func (c *Conn) GetKeyword(ctx context.Context, id int64) (*Keyword, error)
- func (c *Conn) GetKeywords(ctx context.Context, limit int) (*KeywordResult, error)
- func (c *Conn) GetRecommendation(ctx context.Context, id int64) (*Recommendation, error)
- func (c *Conn) GetRecommendationGenres(ctx context.Context, id int64) (*GenreResult, error)
- func (c *Conn) GetRecommendationItem(ctx context.Context, id int64) (*RecommendationItem, error)
- func (c *Conn) GetRecommendationItemSources(ctx context.Context, id int64) (*SourceResult, error)
- func (c *Conn) GetRecommendationItems(ctx context.Context, id int64) (*RecommendationItemResult, error)
- func (c *Conn) GetRecommendationItemsTotalRows(ctx context.Context, id int64) (float64, error)
- func (c *Conn) GetRecommendationKeywords(ctx context.Context, id int64) (*KeywordResult, error)
- func (c *Conn) GetRecommendationTotalRows(ctx context.Context) (int, error)
- func (c *Conn) GetRecommendations(ctx context.Context, offset, limit int) (*[]Recommendation, error)
- func (c *Conn) GetRecommendationsAdmin(ctx context.Context) (*RecommendationResult, error)
- func (c *Conn) GetSearchRecommendationTotalRows(ctx context.Context, search string) (int, error)
- func (c *Conn) GetSource(ctx context.Context, id int64) (*Source, error)
- func (c *Conn) GetSources(ctx context.Context) (*SourceResult, error)
- func (c *Conn) GetUser(ctx context.Context, id int64) (*User, error)
- func (c *Conn) GetUsers(ctx context.Context) (*UserResult, error)
- func (c *Conn) IsEmpty(s map[int64][]int) bool
- func (c *Conn) SearchGenre(ctx context.Context, search string) (*GenreResult, error)
- func (c *Conn) SearchKeyword(ctx context.Context, search string) (*KeywordResult, error)
- func (c *Conn) SearchRecommendation(ctx context.Context, offset, limit int, search string) (*[]Recommendation, error)
- func (c *Conn) SearchSource(ctx context.Context, search string) (*SourceResult, error)
- func (c *Conn) SearchUser(ctx context.Context, search string) (*UserResult, error)
- func (c *Conn) Sync(ctx context.Context, s map[int64][]int, pivot, field string) error
- func (c *Conn) UpdateGenre(ctx context.Context, id int64, g *Genre) error
- func (c *Conn) UpdateKeyword(ctx context.Context, id int64, k *Keyword) error
- func (c *Conn) UpdateRecommendation(ctx context.Context, id int64, r *Recommendation) error
- func (c *Conn) UpdateRecommendationItem(ctx context.Context, id int64, r *RecommendationItem) error
- func (c *Conn) UpdateSource(ctx context.Context, id int64, s *Source) error
- func (c *Conn) UpdateUser(ctx context.Context, id int64, u *User) error
- type Genre
- type GenreResult
- type Keyword
- type KeywordResult
- type Recommendation
- type RecommendationCreate
- type RecommendationGenres
- type RecommendationItem
- type RecommendationItemCreate
- type RecommendationItemResult
- type RecommendationItemSources
- type RecommendationKeywords
- type RecommendationResult
- type Search
- type Source
- type SourceResult
- type User
- type UserResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { ID int64 `json:"id"` Name string `json:"name"` Email string `json:"email" validate:"required,email"` Password string `json:"password,omitempty" validate:"required"` }
Auth type is a struct for authentication.
type AuthClaims ¶
type AuthClaims struct { ID int64 `json:"id"` Name string `json:"name"` Email string `json:"email"` jwt.StandardClaims }
AuthClaims type is a struct for JWT Claims.
type AuthJWT ¶
type AuthJWT struct {
Token string `json:"token"`
}
AuthJWT type is a struct for JWT authentication.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn type is a struct for connections.
func (*Conn) Attach ¶
Attach receives a map of int/[]int and attach the IDs on the given pivot table.
func (*Conn) Authenticate ¶
Authenticate authenticates the current user and returns it's info.
func (*Conn) CreateGenre ¶
CreateGenre creates a new genre.
func (*Conn) CreateKeyword ¶
CreateKeyword creates a new keyword.
func (*Conn) CreateRecommendation ¶
CreateRecommendation creates a new recommendation.
func (*Conn) CreateRecommendationItem ¶
CreateRecommendationItem creates a new recommendation item.
func (*Conn) CreateSource ¶
CreateSource creates a new source.
func (*Conn) CreateUser ¶
CreateUser creates a new user.
func (*Conn) DeleteGenre ¶
DeleteGenre deletes a genre by ID.
func (*Conn) DeleteKeyword ¶
DeleteKeyword deletes a keyword by ID.
func (*Conn) DeleteRecommendation ¶
DeleteRecommendation deletes a recommendation by a given ID.
func (*Conn) DeleteRecommendationItem ¶
DeleteRecommendationItem deletes a recommendation item by a given ID.
func (*Conn) DeleteSource ¶
DeleteSource deletes a source by a given ID.
func (*Conn) DeleteUser ¶
DeleteUser deletes a user by a given ID.
func (*Conn) Detach ¶
Detach receives a map of int/[]int and Detach the IDs on the given pivot table.
func (*Conn) GetAuthenticationInfo ¶
GetAuthenticationInfo retrieves info for the authenticated user.
func (*Conn) GetKeyword ¶
GetKeyword retrieves a keyword by ID.
func (*Conn) GetKeywords ¶
GetKeywords retrieves the latest keywords.
func (*Conn) GetRecommendation ¶
GetRecommendation retrieves a recommendation by ID.
func (*Conn) GetRecommendationGenres ¶
GetRecommendationGenres retrieves all genres of a given recommendation.
func (*Conn) GetRecommendationItem ¶
GetRecommendationItem retrieves a recommendation items by a given ID.
func (*Conn) GetRecommendationItemSources ¶
GetRecommendationItemSources retrieves all sources of a given recommendation item.
func (*Conn) GetRecommendationItems ¶
func (c *Conn) GetRecommendationItems(ctx context.Context, id int64) (*RecommendationItemResult, error)
GetRecommendationItems retrieves all items of a given recommendation by ID.
func (*Conn) GetRecommendationItemsTotalRows ¶
GetRecommendationItemsTotalRows retrieves the total rows of items of a recommendation.
func (*Conn) GetRecommendationKeywords ¶
GetRecommendationKeywords retrieves all keywords of a given recommendation.
func (*Conn) GetRecommendationTotalRows ¶
GetRecommendationTotalRows retrieves the total rows of recommendations table.
func (*Conn) GetRecommendations ¶
func (c *Conn) GetRecommendations(ctx context.Context, offset, limit int) (*[]Recommendation, error)
GetRecommendations retrieves the latest recommendations. Receives two parameters, the database offset and limit.
func (*Conn) GetRecommendationsAdmin ¶
func (c *Conn) GetRecommendationsAdmin(ctx context.Context) (*RecommendationResult, error)
GetRecommendationsAdmin retrieves the latest recommendations. Admin does not have filter for status.
func (*Conn) GetSearchRecommendationTotalRows ¶
GetSearchRecommendationTotalRows retrieves the total rows of recommendations table.
func (*Conn) GetSources ¶
func (c *Conn) GetSources(ctx context.Context) (*SourceResult, error)
GetSources retrieves the latest 20 sources.
func (*Conn) GetUsers ¶
func (c *Conn) GetUsers(ctx context.Context) (*UserResult, error)
GetUsers retrieves the first twenty users.
func (*Conn) SearchGenre ¶
SearchGenre search for genres.
func (*Conn) SearchKeyword ¶
SearchKeyword search for keywords.
func (*Conn) SearchRecommendation ¶
func (c *Conn) SearchRecommendation(ctx context.Context, offset, limit int, search string) (*[]Recommendation, error)
SearchRecommendation search for recommendations.
func (*Conn) SearchSource ¶
SearchSource search for sources.
func (*Conn) SearchUser ¶
SearchUser search for users.
func (*Conn) UpdateGenre ¶
UpdateGenre updates a genre by ID.
func (*Conn) UpdateKeyword ¶
UpdateKeyword updates a keyword by ID.
func (*Conn) UpdateRecommendation ¶
UpdateRecommendation updates a recommendation by a given ID.
func (*Conn) UpdateRecommendationItem ¶
UpdateRecommendationItem updates a recommendation item by a given ID.
func (*Conn) UpdateSource ¶
UpdateSource updates a source by a given ID.
type Genre ¶
type Genre struct { ID int64 `json:"id"` Name string `json:"name" validate:"required"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
Genre type is a struct for genres table.
type GenreResult ¶
type GenreResult struct {
Data *[]Genre `json:"data"`
}
GenreResult type is a result slice for genres.
type Keyword ¶
type Keyword struct { ID int64 `json:"id"` Name string `json:"name" validate:"required"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
Keyword type is a struct for keywords table.
type KeywordResult ¶
type KeywordResult struct {
Data *[]Keyword `json:"data"`
}
KeywordResult type is a result slice for keywords.
type Recommendation ¶
type Recommendation struct { ID int64 `json:"id"` UserID int64 `db:"user_id" json:"user_id" validate:"required"` Title string `json:"title" validate:"required"` Type int `json:"type"` Body string `json:"body" validate:"required"` Poster string `json:"poster" validate:"required"` Backdrop string `json:"backdrop" validate:"required"` Status int `json:"status"` Genres string `json:"genres"` Keywords string `json:"keywords"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
Recommendation type is a struct for the recommendations table.
type RecommendationCreate ¶
type RecommendationCreate struct { *Recommendation Genres []int `json:"genres" validate:"gte=1"` Keywords []int `json:"keywords" validate:"gte=1"` }
RecommendationCreate type is a struct for decode the recommendation post request.
type RecommendationGenres ¶
RecommendationGenres type is a struct for the genre_recommendation pivot table.
type RecommendationItem ¶
type RecommendationItem struct { ID int64 `json:"id"` RecommendationID int64 `db:"recommendation_id" json:"recommendation_id" validate:"required,numeric"` Name string `json:"name" validate:"required"` TMDBID int64 `db:"tmdb_id" json:"tmdb_id" validate:"required,numeric"` Year time.Time `json:"year"` Overview string `json:"overview" validate:"required"` Poster string `json:"poster" validate:"required"` Backdrop string `json:"backdrop" validate:"required"` Trailer string `json:"trailer"` Commentary string `json:"commentary"` MediaType string `db:"media_type" json:"media_type" validate:"required"` Sources string `json:"sources"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
RecommendationItem type is a struct for recommendation_items table.
type RecommendationItemCreate ¶
type RecommendationItemCreate struct { *RecommendationItem Sources []int `json:"sources" validate:"gte=1"` Year string `json:"year" validate:"required"` }
RecommendationItemCreate type is a struct for decode recommendation item post request.
type RecommendationItemResult ¶
type RecommendationItemResult struct {
Data *[]RecommendationItem `json:"data"`
}
RecommendationItemResult type is a slice of recommendation items.
type RecommendationItemSources ¶
RecommendationItemSources type is a struct for recommendation_item_source pivot table.
type RecommendationKeywords ¶
RecommendationKeywords type is a struct for the keyword_recommendation pivot table.
type RecommendationResult ¶
type RecommendationResult struct { Data *[]Recommendation `json:"data"` *tome.Chapter }
RecommendationResult type is a result slice for recommendations.
type Source ¶
type Source struct { ID int64 `json:"id"` Name string `json:"name" validate:"required"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
Source type is a struct for sources table.
type SourceResult ¶
type SourceResult struct {
Data *[]Source `json:"data"`
}
SourceResult type is a slice of sources.
type User ¶
type User struct { ID int64 `json:"id"` Name string `json:"name" validate:"required"` Email string `json:"email" validate:"required,email"` Password string `json:"password" validate:"required,min=8"` APIToken uuid.UUID `db:"api_token" json:"api_token"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
User type is a struct for users table.
type UserResult ¶
type UserResult struct {
Data *[]User `json:"data"`
}
UserResult type is a slice of users.