model

package
v0.0.0-...-43633ff Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonDates

type CommonDates struct {
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
}

CommonDates is a set of common dates fields

type Community

type Community struct {
	PrimaryID
	OwnerID   uint   `json:"owner_id"`
	Owner     User   `json:"owner"`
	Name      string `json:"name"`
	IsPrivate bool   `json:"is_private"`
	CommonDates
	// contains filtered or unexported fields
}

Community is the community datasource skelton

type PrimaryID

type PrimaryID struct {
	ID uint `json:"id"`
}

PrimaryID is an ID field common to most models

type User

type User struct {
	PrimaryID
	Username          string `json:"username"`
	DisplayName       string `json:"display_name"`
	FirstName         string `json:"first_name"`
	LastName          string `json:"last_name"`
	Email             string `json:"email"`
	Password          string `json:"password"`
	Avatar            string `json:"avatar"`
	VerificationToken string `json:"verification_token"`
	CanLogIn          bool   `json:"can_log_in"`
	CommonDates
}

User is the user datasource skeleton

func (*User) BeforeInsert

func (user *User) BeforeInsert(db orm.DB) error

BeforeInsert is the User model before insert hook

func (*User) Insert

func (user *User) Insert(db orm.DB) error

Insert inserts a new user

Jump to

Keyboard shortcuts

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