models

package
v0.0.0-...-808fada Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	FilePath string `json:"filePath"`
}

File a file object

type FileUploadReturn

type FileUploadReturn struct {
	File File `json:"data"`
}

FileUploadReturn DTO for file upload

type Menu struct {
	gorm.Model

	Name      string
	MenuItems []MenuItem
}

Menu a menu to be used on the front-end

type MenuItem struct {
	gorm.Model

	Name   string
	URL    string
	Weight uint
	MenuID uint
}

MenuItem is an item for a menu

type Post

type Post struct {
	gorm.Model

	Title string
	Body  string
	Slug  string `gorm:"type:varchar(100);unique_index"`

	UserID int
	User   User
}

Post a post

func (*Post) FormattedDate

func (p *Post) FormattedDate() string

FormattedDate returns the post's CreatedAt date, but formatted

type Profile

type Profile struct {
	gorm.Model

	UserID      uint
	NickName    string `gorm:"size:128"`
	FirstName   string `gorm:"size:128"`
	LastName    string `gorm:"size:128"`
	PhotoURL    string `gorm:"size:2000"`
	PublicEmail string `gorm:"size:256"`
	Phone       string `gorm:"size:30"`
	Twitter     string `gorm:"size:128"`
	Github      string `gorm:"size:128"`
	Note        string `gorm:"type:TEXT"`
}

Profile the users profile

func (*Profile) DisplayName

func (p *Profile) DisplayName() string

DisplayName returns either the nickname if it's not empty, or the First+Last Name

type User

type User struct {
	gorm.Model

	Email    string `gorm:"type:varchar(100);unique_index"`
	Password string
	Profile  Profile
	Posts    []Post
}

User the user of our application

type ViewMenus

type ViewMenus struct {
	// contains filtered or unexported fields
}

ViewMenus data structure for menus in views

func NewViewMenus

func NewViewMenus(menus map[string]Menu) *ViewMenus

NewViewMenus returns a new ViewMenus

func (*ViewMenus) GetMenu

func (vm *ViewMenus) GetMenu(name string) Menu

GetMenu returns a menu for a view

Jump to

Keyboard shortcuts

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