models

package
v0.0.0-...-fae5159 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	KeyGenreID        = "id"
	KeyGenreName      = "name"
	KeyGenreCreatedAt = "created_at"
	KeyGenreUpdatedAt = "updated_at"
)
View Source
const (
	KeyLanguageID          = "id"
	KeyLanguageIso         = "iso"
	KeyLanguageEnglishName = "english_name"
	KeyLanguageName        = "name"
	KeyLanguageCreatedAt   = "created_at"
	KeyLanguageUpdatedAt   = "updated_at"
)
View Source
const (
	KeyMovieID                  = "id"
	KeyMovieTitle               = "title"
	KeyMovieOriginalTitle       = "original_title"
	KeyMovieLocalTitle          = "local_title"
	KeyMovieOriginalLanguage    = "original_language"
	KeyMovieLanguages           = "languages"
	KeyMovieOverview            = "overview"
	KeyMovieTagline             = "tagline"
	KeyMovieGenres              = "genres"
	KeyMovieHomepage            = "homepage"
	KeyMovieRuntime             = "runtime"
	KeyMovieStatus              = "status"
	KeyMovieAdult               = "adult"
	KeyMovieImdbId              = "imdb_id"
	KeyMovieReleaseDate         = "release_date"
	KeyMovieProductionCompanies = "production_companies"
	KeyMovieProductionCountries = "production_countries"
	KeyMovieVoteAverage         = "vote_average"
	KeyMovieVoteCount           = "vote_count"
	KeyMoviePopularity          = "popularity"
	KeyMovieBudget              = "budget"
	KeyMovieRevenue             = "revenue"
	KeyMovieBackdrop            = "backdrop"
	KeyMoviePoster              = "poster"
	KeyMovieCreatedAt           = "created_at"
	KeyMovieUpdatedAt           = "updated_at"
)
View Source
const (
	KeyPermissionID        = "id"
	KeyPermissionName      = "name"
	KeyPermissionCreatedAt = "created_at"
	KeyPermissionUpdatedAt = "updated_at"
)
View Source
const (
	KeyUserID              = "id"
	KeyUserUsername        = "username"
	KeyUserEmail           = "email"
	KeyUserEmailVerifiedAt = "email_verified_at"
	KeyUserPassword        = "password"
	KeyUserRememberToken   = "remember_token"
	KeyUserCreatedAt       = "created_at"
	KeyUserUpdatedAt       = "updated_at"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Genre

type Genre struct {
	ID   uint64 `json:"id" gorm:"primary_key"`
	Name string `json:"name" gorm:"size:255;not null"`
	Timestamps
}

func (*Genre) BeforeCreate

func (genre *Genre) BeforeCreate(transaction *gorm.DB) error

Action which will be executed before new model is added to the database

func (*Genre) BeforeDelete

func (genre *Genre) BeforeDelete(transaction *gorm.DB) error

Action which will be executed before model entry is deleted from the database

func (*Genre) BeforeUpdate

func (genre *Genre) BeforeUpdate(transaction *gorm.DB) error

Action which will be executed before model is updated

func (*Genre) FromProto

func (genre *Genre) FromProto(protoGenre *proto.Genre)

Extract model from proto

func (*Genre) PrimaryKey

func (genre *Genre) PrimaryKey() uint64

Get primary key of the table

func (*Genre) TableName

func (genre *Genre) TableName() string

Provide the table name for Gorm

func (*Genre) ToProto

func (genre *Genre) ToProto() *proto.Genre

Convert model to proto

func (*Genre) UpdatedFields

func (genre *Genre) UpdatedFields(updateID bool, updatedFields ...string) map[string]interface{}

Get list of updated fields

type Language

type Language struct {
	ID          uint64 `json:"id" gorm:"primary_key"`
	Iso         string `json:"iso_639_1" gorm:"unique;not null" sql:"type:VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci"`
	EnglishName string `json:"english_name" gorm:"not null" sql:"type:VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci"`
	Name        string `json:"name" gorm:"not null" sql:"type:VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci"`
	Timestamps
}

func (*Language) BeforeCreate

func (language *Language) BeforeCreate(transaction *gorm.DB) error

Action which will be executed before new model is added to the database

func (*Language) BeforeDelete

func (language *Language) BeforeDelete(transaction *gorm.DB) error

Action which will be executed before model entry is deleted from the database

func (*Language) BeforeUpdate

func (language *Language) BeforeUpdate(transaction *gorm.DB) error

Action which will be executed before model is updated

func (*Language) FromProto

func (language *Language) FromProto(protoLanguage *proto.Language)

Extract model from proto

func (*Language) PrimaryKey

func (language *Language) PrimaryKey() uint64

Get primary key of the table

func (*Language) TableName

func (language *Language) TableName() string

Provide the table name for Gorm

func (*Language) ToProto

func (language *Language) ToProto() *proto.Language

Convert model to proto

func (*Language) UpdatedFields

func (language *Language) UpdatedFields(updateID bool, updatedFields ...string) map[string]interface{}

Get list of updated fields

type Movie

type Movie struct {
	ID                  uint64          `json:"id" gorm:"size:10;not null;not_auto_increment"`
	Title               string          `json:"title" gorm:"size:255;not null"`
	OriginalTitle       string          `json:"original_title" gorm:"size:255;not null"`
	LocalTitle          string          `json:"local_title" gorm:"size:255"`
	OriginalLanguage    string          `json:"original_language" gorm:"size:255"`
	Languages           json.RawMessage `json:"languages" gorm:"type:json" sql:"type:longtext"`
	Overview            string          `json:"overview" sql:"type:longtext"`
	Tagline             string          `json:"tagline" gorm:"size:255"`
	Genres              json.RawMessage `json:"genres" gorm:"type:json" sql:"type:longtext"`
	Homepage            string          `json:"homepage" gorm:"size:255"`
	Runtime             uint64          `json:"runtime" gorm:"size:10"`
	Status              uint64          `json:"status" gorm:"size:10"`
	Adult               bool            `json:"adult" gorm:"default:false"`
	ImdbId              string          `json:"imdb_id" gorm:"size:255"`
	ReleaseDate         string          `json:"release_date" gorm:"size:255"`
	ProductionCompanies json.RawMessage `json:"production_companies" gorm:"type:json" sql:"type:longtext"`
	ProductionCountries json.RawMessage `json:"production_countries" gorm:"type:json" sql:"type:longtext"`
	VoteAverage         float64         `json:"vote_average" sql:"type:double"`
	VoteCount           uint64          `json:"vote_count" gorm:"size:10"`
	Popularity          float64         `json:"popularity" sql:"type:double"`
	Budget              uint64          `json:"budget" gorm:"size:10"`
	Revenue             uint64          `json:"revenue" gorm:"size:10"`
	Backdrop            string          `json:"backdrop" gorm:"size:255"`
	Poster              string          `json:"poster" gorm:"size:255"`
	Timestamps
}

func (*Movie) BeforeCreate

func (movie *Movie) BeforeCreate(transaction *gorm.DB) error

Action which will be executed before new model is added to the database

func (*Movie) BeforeDelete

func (movie *Movie) BeforeDelete(transaction *gorm.DB) error

Action which will be executed before model entry is deleted from the database

func (*Movie) BeforeUpdate

func (movie *Movie) BeforeUpdate(transaction *gorm.DB) error

Action which will be executed before model is updated

func (*Movie) FromProto

func (movie *Movie) FromProto(protoMovie *proto.Movie)

Extract model from proto

func (*Movie) PrimaryKey

func (movie *Movie) PrimaryKey() uint64

Get primary key of the table

func (*Movie) TableName

func (movie *Movie) TableName() string

Provide the table name for Gorm

func (*Movie) ToProto

func (movie *Movie) ToProto() *proto.Movie

Convert model to proto

func (*Movie) UpdatedFields

func (movie *Movie) UpdatedFields(updateID bool, updatedFields ...string) map[string]interface{}

Get list of updated fields

type Permission

type Permission struct {
	ID   uint64 `gorm:"primary_key"`
	Name string `gorm:"size:255"`
	Timestamps
}

func (*Permission) BeforeCreate

func (permission *Permission) BeforeCreate(transaction *gorm.DB) error

Action which will be executed before new model is added to the database

func (*Permission) BeforeDelete

func (permission *Permission) BeforeDelete(transaction *gorm.DB) error

Action which will be executed before model entry is deleted from the database

func (*Permission) BeforeUpdate

func (permission *Permission) BeforeUpdate(transaction *gorm.DB) error

Action which will be executed before model is updated

func (*Permission) PrimaryKey

func (permission *Permission) PrimaryKey() uint64

Get primary key of the table

func (*Permission) TableName

func (permission *Permission) TableName() string

Provide the table name for Gorm

func (*Permission) UpdatedFields

func (permission *Permission) UpdatedFields(updateID bool, updatedFields ...string) map[string]interface{}

Get list of updated fields

type SoftDeleteTimestamps

type SoftDeleteTimestamps struct {
	Timestamps
	DeletedAt *time.Time `json:"deleted_at" gorm:"default:null"`
}

type Timestamps

type Timestamps struct {
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Timestamps) BeforeSave

func (timestamp *Timestamps) BeforeSave() error

func (*Timestamps) BeforeUpdate

func (timestamp *Timestamps) BeforeUpdate() error

type User

type User struct {
	ID              uint64     `gorm:"primary_key"`
	Username        string     `gorm:"unique;size:255"`
	Email           string     `gorm:"unique;size:255"`
	EmailVerifiedAt *time.Time `gorm:"default:null"`
	Password        string     `gorm:"size:255"`
	RememberToken   string     `gorm:"size:100"`
	Timestamps
}

func (*User) BeforeCreate

func (user *User) BeforeCreate(transaction *gorm.DB) error

Action which will be executed before new model is added to the database

func (*User) BeforeDelete

func (user *User) BeforeDelete(transaction *gorm.DB) error

Action which will be executed before model entry is deleted from the database

func (*User) BeforeUpdate

func (user *User) BeforeUpdate(transaction *gorm.DB) error

Action which will be executed before model is updated

func (*User) PrimaryKey

func (user *User) PrimaryKey() uint64

Get primary key of the table

func (*User) TableName

func (user *User) TableName() string

Provide the table name for Gorm

func (*User) UpdatedFields

func (user *User) UpdatedFields(updateID bool, updatedFields ...string) map[string]interface{}

Get list of updated fields

Jump to

Keyboard shortcuts

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