model

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

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OK = map[string]bool{
	"ok": true,
}

OK is just an OK constant to return when all good :)

Functions

This section is empty.

Types

type DBFile

type DBFile struct {
	ID          uuid.UUID `pg:"id,notnull,pk"`
	Filename    string    `pg:"filename,notnull"`
	ContentType string    `pg:"-" gorm:"-"`
	CreatedAt   time.Time `pg:"created_at,notnull"`
	// contains filtered or unexported fields
}

DBFile is a file in Postgres

func (DBFile) TableName

func (DBFile) TableName() string

TableName overrides default table name for gorm

func (*DBFile) ToWeb

func (dbFile *DBFile) ToWeb() *File

ToWeb converts DBFile to File

type DBUser

type DBUser struct {
	ID        uuid.UUID `pg:"id,notnull,pk"`
	Firstname string    `pg:"firstname,notnull"`
	Lastname  string    `pg:"lastname,notnull"`
	CreatedAt time.Time `pg:"created_at,notnull"`
	// contains filtered or unexported fields
}

DBUser is a Postgres user

func (DBUser) TableName

func (DBUser) TableName() string

TableName overrides default table name for gorm

func (*DBUser) ToWeb

func (dbUser *DBUser) ToWeb() *User

ToWeb converts DBUser to User

type File

type File struct {
	ID        uuid.UUID `json:"id"`
	Filename  string    `json:"filename" validate:"required"`
	CreatedAt time.Time `json:"created_at"`
}

File holds file metadata as a JSON

func (*File) ToDB

func (file *File) ToDB() *DBFile

ToDB converts File to DBFile

type User

type User struct {
	ID        uuid.UUID `json:"id"`
	Firstname string    `json:"firstname" validate:"required"`
	Lastname  string    `json:"lastname" validate:"required"`
	CreatedAt time.Time `json:"created_at"`
}

User is a JSON user

func (*User) ToDB

func (user *User) ToDB() *DBUser

ToDB converts User to DBUser

Jump to

Keyboard shortcuts

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