model

package
v0.0.0-...-4468c4e Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

func (*Base) BeforeCreate

func (e *Base) BeforeCreate(tx *gorm.DB) (err error)

type KeyPair

type KeyPair struct {
	Base
	PrivateKey string
	PublicKey  string
}

func (*KeyPair) BeforeCreate

func (e *KeyPair) BeforeCreate(tx *gorm.DB) (err error)

type Role

type Role struct {
	Name        string `gorm:"type:varchar(255);primary_key"`
	Description string `gorm:"type:varchar(255);"`
}

Role represents user role entity.

type User

type User struct {
	Base
	Username  string `gorm:"unique"`
	FirstName string
	LastName  string
	Email     string `gorm:"unique"`
	Password  string
	Websites  []Website
	KeyPairID uuid.UUID `gorm:"->;<-:create"`
	KeyPair   KeyPair   `gorm:"->;<-:create"`
	Roles     []Role    `gorm:"many2many:user_roles"`
}

User represents user entity.

func (*User) BeforeCreate

func (e *User) BeforeCreate(tx *gorm.DB) (err error)

func (*User) GetRoles

func (e *User) GetRoles() (roles []string)

type Website

type Website struct {
	Base
	URL    string
	Token  sqlType.WebsiteToken
	UserID uuid.UUID
}

Website represents website entity.

Jump to

Keyboard shortcuts

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