models

package
v0.0.0-...-4e290a4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID     string   `json:"id"`
	Name   string   `json:"name"  validate:"required"`
	Artist string   `json:"artist" validate:"required"`
	Tracks []string `json:"tracks" validate:"min=1"`
	Year   string   `json:"year" validate:"numeric"`
}

Album - stores the details for a album

func (*Album) GetID

func (al *Album) GetID() string

GetID - implement itemID interface

func (*Album) SetID

func (al *Album) SetID(id string)

SetID - implement itemID interface

type User

type User struct {
	ID             primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	FirstName      string             `json:"firstname" validate:"alpha" bson:"firstname,omitempty"`
	LastName       string             `json:"lastname" validate:"alpha" bson:"lastname,omitempty"`
	NickName       string             `json:"nickname" validate:"alphanum" bson:"nickname,omitempty"`
	Email          string             `json:"email" validate:"required,email" bson:"email,omitempty"`
	Country        string             `json:"country" validate:"alpha" bson:"country,omitempty"`
	HashedPassword string             `json:"hash"`
}

User - stores the details for a album

func (*User) CompareSaltandHash

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

CompareSaltandHash - implement HashedItem interface to compare password

func (*User) GetID

func (u *User) GetID() string

GetID - implement itemID interface

type UserFormData

type UserFormData struct {
	User
	Password *string `json:"password,omitempty" validate:"required"`
}

func (*UserFormData) GetIDItem

func (u *UserFormData) GetIDItem() database.IDItem

GetIDItem - get underlying user from the form data

func (*UserFormData) SaltandHash

func (u *UserFormData) SaltandHash() error

SaltandHash - implement HashedItem interface to encrypt password

func (*UserFormData) SetIDItem

func (u *UserFormData) SetIDItem(item database.IDItem) error

SetIDItem - set the user content in the form data

Jump to

Keyboard shortcuts

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