Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
DB connecter
Functions ¶
Types ¶
type Application ¶
type Application struct { Base Name string `gorm:"column:name" json:"name"` Slug string `gorm:"column:slug" json:"slug"` Description string `gorm:"column:description" json:"description"` URL string `gorm:"column:url" json:"url"` MediumID *uint `gorm:"column:medium_id;default:NULL" json:"medium_id"` Medium *Medium `gorm:"foreignKey:medium_id" json:"medium"` OrganisationID uint `gorm:"column:organisation_id" json:"organisation_id"` Organisation *Organisation `gorm:"foreignKey:organisation_id" json:"organisation,omitempty"` Users []User `gorm:"many2many:application_users;" json:"users"` Tokens []ApplicationToken `json:"tokens"` }
Application model defination
func (*Application) BeforeCreate ¶
func (application *Application) BeforeCreate(tx *gorm.DB) error
BeforeCreate hook
func (*Application) BeforeSave ¶
func (application *Application) BeforeSave(tx *gorm.DB) (e error)
BeforeSave - validation for medium
type ApplicationToken ¶
type ApplicationToken struct { Base Name string `gorm:"column:name" json:"name"` Description string `gorm:"column:description" json:"description"` ApplicationID *uint `gorm:"column:application_id" json:"application_id"` Application *Application `gorm:"foreignKey:application_id" json:"application"` AccessToken string `gorm:"column:access_token" json:"access_token,omitempty"` HashedToken string `gorm:"column:hashed_token" json:"-"` }
type Base ¶
type Base struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *gorm.DeletedAt `gorm:"index" json:"deleted_at" swaggertype:"primitive,string"` CreatedByID uint `gorm:"column:created_by_id" json:"created_by_id"` UpdatedByID uint `gorm:"column:updated_by_id" json:"updated_by_id"` }
Base with id, created_at, updated_at & deleted_at
type Medium ¶
type Medium struct { Base Name string `gorm:"column:name" json:"name"` Slug string `gorm:"column:slug" json:"slug"` Type string `gorm:"column:type" json:"type"` Title string `gorm:"column:title" json:"title"` Description string `gorm:"column:description" json:"description"` Caption string `gorm:"column:caption" json:"caption"` AltText string `gorm:"column:alt_text" json:"alt_text"` FileSize int64 `gorm:"column:file_size" json:"file_size"` URL postgres.Jsonb `gorm:"column:url" json:"url" swaggertype:"primitive,string"` Dimensions string `gorm:"column:dimensions" json:"dimensions"` UserID uint `gorm:"column:user_id" json:"user_id"` }
Medium model
func (*Medium) AfterCreate ¶
AfterCreate hook
func (*Medium) BeforeCreate ¶
BeforeCreate hook
type Organisation ¶
type Organisation struct { Base Title string `gorm:"column:title" json:"title"` Slug string `gorm:"column:slug" json:"slug"` Description string `gorm:"column:description" json:"description"` FeaturedMediumID *uint `gorm:"column:featured_medium_id;default:NULL" json:"featured_medium_id"` Medium *Medium `gorm:"foreignKey:featured_medium_id" json:"medium"` }
Organisation model definition
func (*Organisation) BeforeCreate ¶
func (org *Organisation) BeforeCreate(tx *gorm.DB) error
BeforeCreate hook
func (*Organisation) BeforeSave ¶
func (org *Organisation) BeforeSave(tx *gorm.DB) (e error)
BeforeSave - validation for medium
type OrganisationUser ¶
type OrganisationUser struct { Base UserID uint `gorm:"column:user_id" json:"user_id"` User *User `json:"user"` OrganisationID uint `gorm:"column:organisation_id" json:"organisation_id"` Organisation *Organisation `json:"organisation"` Role string `gorm:"column:role" json:"role"` }
OrganisationUser model definition
func (*OrganisationUser) BeforeCreate ¶
func (orgUser *OrganisationUser) BeforeCreate(tx *gorm.DB) error
BeforeCreate hook
type Policy ¶
type Policy struct { ID string `json:"id"` Subjects []string `json:"subjects"` Resources []string `json:"resources"` Actions []string `json:"actions"` Effect string `json:"effect"` }
Policy in keto
type User ¶
type User struct { Base Email string `gorm:"column:email;uniqueIndex" json:"email"` KID string `gorm:"column:kid;" json:"kid"` FirstName string `gorm:"column:first_name" json:"first_name"` LastName string `gorm:"column:last_name" json:"last_name"` Slug string `gorm:"column:slug" json:"slug"` DisplayName string `gorm:"column:display_name" json:"display_name"` BirthDate string `gorm:"column:birth_date" json:"birth_date"` Gender string `gorm:"column:gender" json:"gender"` FeaturedMediumID *uint `gorm:"column:featured_medium_id;default:NULL" json:"featured_medium_id"` Medium *Medium `gorm:"foreignKey:featured_medium_id" json:"medium"` SocialMediaURLs postgres.Jsonb `gorm:"column:social_media_urls" json:"social_media_urls" swaggertype:"primitive,string"` Description string `gorm:"column:description" json:"description"` }
User model definition
Click to show internal directories.
Click to hide internal directories.