model

package
v0.0.0-...-cea713b Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID           uuid.UUID             `json:"id" gorm:"primary_key;type:uuid;default:gen_random_uuid()"`
	ScopeID      uuid.UUID             `json:"-" gorm:"type:uuid;"`
	Scope        Scope                 `json:"scope" gorm:"foreignkey:ScopeID;association_foreignkey:ID;constraint:OnUpdate:Cascade,OnDelete:Cascade;"`
	Key          string                `json:"key" validate:"required,min=3"`
	Description  string                `json:"description" validate:"required,min=3"`
	Arguments    []*MessageArgument    `json:"arguments" gorm:"foreignkey:MessageID;association_foreignkey:ID;constraint:OnUpdate:Cascade,OnDelete:Cascade;"`
	Translations []*MessageTranslation `json:"translations" gorm:"foreignkey:MessageID;association_foreignkey:ID;constraint:OnUpdate:Cascade,OnDelete:Cascade;"`
}

type MessageArgument

type MessageArgument struct {
	ID          uuid.UUID `json:"id" gorm:"primary_key;type:uuid;default:gen_random_uuid()"`
	MessageID   uuid.UUID `json:"-" gorm:"type:uuid;"`
	Message     Message   `json:"-" gorm:"foreignkey:MessageID;association_foreignkey:ID;constraint:OnUpdate:Cascade,OnDelete:Cascade;"`
	Name        string    `json:"name" validate:"required,min=3"`
	Description string    `json:"description" validate:"required,min=3"`
}

type MessageTranslation

type MessageTranslation struct {
	ID        uuid.UUID `json:"id" gorm:"primary_key;type:uuid;default:gen_random_uuid()"`
	MessageID uuid.UUID `json:"-" gorm:"type:uuid;"`
	Message   Message   `json:"-" gorm:"foreignkey:MessageID;association_foreignkey:ID;constraint:OnUpdate:Cascade,OnDelete:Cascade;"`
	Locale    string    `json:"locale" validate:"required,min=3"`
	Value     string    `json:"value" validate:"required,min=3"`
}

type Project

type Project struct {
	Id          uint           `json:"id" gorm:"primaryKey;autoIncrement;not null"`
	Name        string         `json:"name" gorm:"not null"`
	Description string         `json:"description"`
	Image       string         `json:"image"`
	Link        string         `json:"link"`
	GithubLink  string         `json:"githubLink"`
	Date        time.Time      `json:"date" gorm:"not null;default:CURRENT_TIMESTAMP"`
	Client      string         `json:"client" gorm:"not null;default:'Niromash'"`
	Categories  pq.StringArray `json:"categories" gorm:"type:text[]"`
	TechStack   pq.StringArray `json:"techStack" gorm:"type:text[]"`
	Images      pq.StringArray `json:"images" gorm:"type:text[]"`
}

func (*Project) GetCategories

func (p *Project) GetCategories() []string

func (*Project) GetClient

func (p *Project) GetClient() string

func (*Project) GetDate

func (p *Project) GetDate() time.Time

func (*Project) GetDescription

func (p *Project) GetDescription() string
func (p *Project) GetGithubLink() string

func (*Project) GetId

func (p *Project) GetId() uint

func (*Project) GetImage

func (p *Project) GetImage() string

func (*Project) GetImages

func (p *Project) GetImages() []string
func (p *Project) GetLink() string

func (*Project) GetName

func (p *Project) GetName() string

func (*Project) GetTechStack

func (p *Project) GetTechStack() []string

type Scope

type Scope struct {
	ID        uuid.UUID      `json:"id" gorm:"primary_key;type:uuid;default:gen_random_uuid()"`
	Name      string         `json:"name" gorm:"unique;not null"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

type User

type User struct {
	ID          uint           `json:"id" gorm:"primary_key;auto_increment;not null"`
	Username    string         `json:"username" gorm:"type:varchar(255);not null;unique"`
	Email       string         `json:"email" gorm:"type:varchar(255);not null;unique"`
	Password    string         `json:"password" gorm:"type:varchar(255);not null"`
	Permissions pq.StringArray `json:"permissions" gorm:"type:varchar(255)[]"`
}

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetId

func (u *User) GetId() uint

func (*User) GetPassword

func (u *User) GetPassword() string

func (*User) GetPermissions

func (u *User) GetPermissions() []string

func (*User) GetUsername

func (u *User) GetUsername() string

func (*User) HasPermission

func (u *User) HasPermission(permission string) bool

HasPermission examples: permission for all actions: * permission for all messages actions: messages.* permission for create message action: messages.create permission for delete message action: messages.delete

Jump to

Keyboard shortcuts

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