models

package
v0.0.0-...-1f850de Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 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 Model

type Model struct {
	ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4()"`

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

type Todo

type Todo struct {
	Model

	Title       string `gorm:"uniqueIndex:title_owner"`
	IsCompleted bool

	OwnerID uuid.UUID `gorm:"uniqueIndex:title_owner"`
	Owner   User      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type User

type User struct {
	Model

	Username     string `gorm:"unique_index"`
	PasswordHash string
}

func NewUser

func NewUser(username, password string) User

func (*User) CanLogin

func (u *User) CanLogin(password string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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