models

package
v0.0.0-...-ac60fc0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

returns a handle to the DB object

func GetFirstFile

func GetFirstFile() map[string]interface{}

func GetFirstGallery

func GetFirstGallery() map[string]interface{}

func GetImagesFromFirstGallery

func GetImagesFromFirstGallery() map[string]interface{}

func GetImagesFromGalleryBySlug

func GetImagesFromGalleryBySlug(slug string) map[string]interface{}

func Login

func Login(email, password string) map[string]interface{}

Types

type Account

type Account struct {
	gorm.Model
	Email    string `json:"email"`
	Password string `json:"password"`
	Token    string `json:"token";sql:"-"`
	Admin    bool
}

a struct to rep user account

func GetUser

func GetUser(u uint) *Account

func (*Account) Create

func (account *Account) Create() map[string]interface{}

func (*Account) Validate

func (account *Account) Validate() (map[string]interface{}, bool)

Validate incoming user details...

type File

type File struct {
	gorm.Model
	Url       string `json:"url"`
	Type      string `json:"type"`
	GalleryID uint
	Pending   bool
}

func (*File) Create

func (file *File) Create() map[string]interface{}
type Gallery struct {
	gorm.Model
	Slug   string `json:"slug"`
	Event  string `json:"event";sql:"-"`
	Year   int    `json:"year"`
	Images []File `gorm:"foreignkey:GalleryID"`
}

func GetGalleryById

func GetGalleryById(id uint) (*Gallery, error)

func GetGalleryBySlug

func GetGalleryBySlug(slug string) (*Gallery, error)

func (*Gallery) AddFile

func (gallery *Gallery) AddFile(file *File)

func (*Gallery) Create

func (gallery *Gallery) Create() map[string]interface{}

func (*Gallery) Validate

func (gallery *Gallery) Validate() (map[string]interface{}, bool)

type Token

type Token struct {
	UserId   uint
	Username string
	jwt.StandardClaims
}

JWT claims struct

Jump to

Keyboard shortcuts

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