models

package
v0.0.0-...-ab3586a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EditProfile

type EditProfile struct {
	Username string `form:"username"  binding:"required"`
	AboutMe  string `form:"about_me"  binding:"required"`
}

type LoginForm

type LoginForm struct {
	Username string `form:"username" binding:"required"`
	Password string `form:"password" binding:"required"`
}

type Post

type Post struct {
	gorm.Model
	UserID int
	User   User
	Body   string `gorm:"type:varchar(512)"`
}

type RegistrationForm

type RegistrationForm struct {
	Username  string `form:"username"  binding:"required"`
	Email     string `form:"email"     binding:"required"`
	PasswordA string `form:"passworda" binding:"required"`
	PasswordB string `form:"passwordb" binding:"required"`
}

func (*RegistrationForm) CheckPasswords

func (r *RegistrationForm) CheckPasswords() bool

type User

type User struct {
	gorm.Model
	UserSession
	Username string `gorm:"type:varchar(32);UNIQUE"`
	Email    string `gorm:"type:varchar(256);UNIQUE"`
	Password string `gorm:"type:varchar(128)"`
	AboutMe  string `gorm:"type:varchar(512)"`
	LastSeen string `gorm:"type:varchar(20)"`
}

func (*User) Avatar

func (u *User) Avatar(s int) string

func (*User) CheckPassword

func (u *User) CheckPassword(p string) bool

func (*User) SetPassword

func (u *User) SetPassword(p string) error

type UserSession

type UserSession struct {
	IsAuthenticated bool `gorm:"-"`
	IsActive        bool `gorm:"-"`
	IsAnonymous     bool `gorm:"-"`
}

Jump to

Keyboard shortcuts

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