models

package
v0.0.0-...-64b357b Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 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 Auth

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

Auth data model

func (*Auth) Read

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

func (*Auth) Serialize

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

Serialize serializes Auth data

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
	Name         string
	Lastname     string
	Email        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