Documentation ¶
Index ¶
Constants ¶
View Source
const ( PolicySubjectAny = "*" PolicyObjectAny = "*" PolicyActionAny = "*" )
View Source
const ( PolicyActionCreate = "create" PolicyActionUpdate = "update" PolicyActionRead = "read" PolicyActionReadAll = "read-all" PolicyActionDelete = "delete" )
View Source
const ( PolicyObjectUser = "user" PolicyObjectMovie = "user" PolicyObjectWatchList = "watch_list" )
View Source
const (
UserContextKey contextKey = "user"
)
Variables ¶
View Source
var ErrMovieNotFound = errors.New("Movie not found")
Functions ¶
func ResponseJson ¶
func ResponseJson(w http.ResponseWriter, data interface{}, resinfo ResponseInfo)
Types ¶
type AllResponse ¶
type AllResponse struct { NormalResponse NormalResponse `yaml:"normal"` UserResponse UserResponse `yaml:"user"` AuthResponse AuthResponse `yaml:"auth"` MovieResponse MovieResponse `yaml:"movie"` }
func Load ¶
func Load() *AllResponse
type AuthResponse ¶
type AuthResponse struct { UserLocked ResponseInfo `yaml:"user_locked"` EmailNotExist ResponseInfo `yaml:"email_not_exist"` PasswordWrong ResponseInfo `yaml:"password_wrong"` TokenInvalid ResponseInfo `yaml:"token_invalid"` }
func Auth ¶
func Auth() AuthResponse
type MovieInfo ¶
type MovieInfo struct { ID string `json:"_id,omitempty"` Name string `json:"name,omitempty"` Rate float64 `json:"rate,omitempty"` Directors []string `json:"directors,omitempty"` Writers []string `json:"writers,omitempty"` TrailersPath []string `json:"trailers_path,omitempty"` ImagesPath []string `json:"images_path,omitempty"` Casts []string `json:"casts,omitempty"` Genres []string `json:"genres,omitempty"` Storyline string `json:"storyline,omitempty"` UserReviews []string `json:"user_reviews,omitempty"` MovieLength int `json:"movie_length,omitempty"` ReleaseTime string `json:"release_time,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` UserId string `json:"user_id,omitempty"` }
type MovieResponse ¶
type MovieResponse struct { Created ResponseInfo `yaml:"created"` DeleteFailed ResponseInfo `yaml:"delete_failed"` NotFound ResponseInfo `yaml:"not_found"` }
func Movie ¶
func Movie() MovieResponse
type NormalResponse ¶
type NormalResponse struct { Success ResponseInfo `yaml:"success"` NotFound ResponseInfo `yaml:"not_found"` TimeOut ResponseInfo `yaml:"timeout"` BadRequest ResponseInfo `yaml:"bad_request"` Internal ResponseInfo `yaml:"internal"` PermissionDeny ResponseInfo `yaml:"permission_deny"` }
func Normal ¶
func Normal() NormalResponse
type ResponseInfo ¶
type UserInfo ¶
type UserInfo struct { ID string `json:"_id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Gender int `json:"gender"` Email string `json:"email"` Role string `json:"role"` Password string `json:"password,omitempty"` Locked bool `json:"locked"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type UserResponse ¶
type UserResponse struct { Created ResponseInfo `yaml:"created"` DuplicateEmail ResponseInfo `yaml:"duplicate_email"` UpdateFailed ResponseInfo `yaml:"update_failed"` CreateFailed ResponseInfo `yaml:"create_failed"` DeleteFailed ResponseInfo `yaml:"delete_failed"` UserNotFound ResponseInfo `yaml:"user_not_found"` }
func User ¶
func User() UserResponse
Click to show internal directories.
Click to hide internal directories.