domain

package
v0.0.0-...-6ebe9bd Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	PrimaryKey
	Name   string
	UserID UUID
}

type PrimaryKey

type PrimaryKey struct {
	ID UUID `gorm:"column:id"`
}

PrimaryKey represents a primary key for an entity in the form of an UUID. The reason it's needed is because not all UUIDs need to have GORM's BeforeCreate hook method. PrimaryKey encapsulates that behaviour, instead.

func (*PrimaryKey) BeforeCreate

func (p *PrimaryKey) BeforeCreate(tx *gorm.DB) error

type UUID

type UUID string

func NewUUID

func NewUUID() (UUID, error)

func ParseUUID

func ParseUUID(s string) (UUID, error)

func (*UUID) Scan

func (u *UUID) Scan(value interface{}) error

func (UUID) String

func (u UUID) String() string

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

type User

type User struct {
	PrimaryKey
	Name  string
	Email string
	Items []Item
}

Jump to

Keyboard shortcuts

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