model

package
v0.0.0-...-ebce001 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	GroupID   uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	GroupName string     `gorm:"type:varchar(100);not null"`
	GroupURL  string     `gorm:"type:varchar(180)"`
	Verified  bool
	Active    bool
	Handle    string `gorm:"type:varchar(50);not null"`
	Ibans     []Iban `gorm:"polymorphic:Owner;"`
}

Group : Model with injected fields `ID`, `CreatedAt`, `UpdatedAt`

type Iban

type Iban struct {
	IbanID      uint `gorm:"primary_key"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `sql:"index"`
	Text        string     `gorm:"type:varchar(100);not null"`
	Description string
	Password    string
	Handle      string `gorm:"type:varchar(20);not null"`
	Active      bool
	IsPrivate   bool
	OwnerID     uint
	OwnerType   string
}

Iban : Model with injected fields `ID`, `CreatedAt`, `UpdatedAt`

func (*Iban) BeforeSave

func (iban *Iban) BeforeSave(tx *gorm.DB) (err error)

BeforeSave Callback

func (*Iban) CheckHandle

func (iban *Iban) CheckHandle(tx *gorm.DB) (exist bool)

Check Handle before create or update = must be add as index to db

func (*Iban) ComparePassword

func (iban *Iban) ComparePassword(password string) bool

ComparePassword : compare the password

func (*Iban) HashPassword

func (iban *Iban) HashPassword()

HashPassword : hashing the password

func (*Iban) Validate

func (iban *Iban) Validate(db *gorm.DB)

type User

type User struct {
	UserID    uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
	Email     string     `gorm:"type:varchar(100);not null"`
	Password  string     `gorm:"not null"`
	Handle    string     `gorm:"not null;unique"`
	FirstName string     `gorm:"type:varchar(50);not null"`
	LastName  string     `gorm:"type:varchar(50);not null"`
	Bio       string     `gorm:"type:text"`
	Visible   bool       // visible email address
	Avatar    string
	Verified  bool
	Active    bool
	Admin     bool
	Ibans     []*Iban `gorm:"polymorphic:Owner;"`
}

User : Model with injected fields `ID`, `CreatedAt`, `UpdatedAt`

func (*User) ComparePassword

func (user *User) ComparePassword(password string) bool

ComparePassword : compare the password

func (*User) HashPassword

func (user *User) HashPassword()

HashPassword : hashing the password

Jump to

Keyboard shortcuts

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