models

package
v0.0.0-...-8a20eb4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB)

Migrate automigrates models using ORM

Types

type Post

type Post struct {
	gorm.Model
	Text   string `sql:"type:text;"`
	User   User   `gorm:"foreignkey:UserID"`
	UserID uint
}

Post data model

func (Post) Serialize

func (p Post) Serialize() common.JSON

Serialize serializes post data

type User

type User struct {
	gorm.Model
	Username     string
	DisplayName  string
	PasswordHash string
}

User data model

func (*User) Read

func (u *User) Read(m common.JSON)

func (*User) Serialize

func (u *User) Serialize() common.JSON

Serialize serializes user data

Jump to

Keyboard shortcuts

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