models

package
v0.0.0-...-6f65a32 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) ([]byte, error)

func VerifyPassword

func VerifyPassword(hashedPassword, password string) error

Types

type Post

type Post struct {
	PostID    int       `gorm:"primary_key;auto_increment"`
	PostName  string    `gorm:"size:40;not null;unique"`
	SubjectID int       `gorm:"not null"`
	IsDeleted bool      `gorm:"default:false" json:"_"`
	CreatedBy int       `json:"_"`
	CreatedOn time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"_"`
	UpdatedBy int       `json:"_"`
	UpdatedOn time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"_"`
}

func (*Post) DeletePost

func (post *Post) DeletePost(db *gorm.DB) error

func (*Post) FindAllPosts

func (post *Post) FindAllPosts(db *gorm.DB) (*[]Post, error)

func (*Post) Prepare

func (post *Post) Prepare()

func (*Post) SavePost

func (post *Post) SavePost(db *gorm.DB) error

func (*Post) UpdatePost

func (post *Post) UpdatePost(db *gorm.DB) error

type User

type User struct {
	UserId    int       `gorm:"primary_key;auto_increment"`
	UserName  string    `gorm:"size:40;not null;unique"`
	Email     string    `gorm:"size:50;not null;unique"`
	RoleId    int       `gorm:"not null"`
	Password  string    `gorm:"size:100;not null;" json:"_"`
	IsDeleted bool      `gorm:"default:false" json:"_"`
	CreatedBy int       `json:"_"`
	CreatedOn time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"_"`
	UpdatedBy int       `json:"_"`
	UpdatedOn time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"_"`
}

func (*User) DeleteAUser

func (u *User) DeleteAUser(db *gorm.DB, uid int) (int64, error)

func (*User) FindAllUsers

func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)

func (*User) FindUserByID

func (u *User) FindUserByID(db *gorm.DB, uid int) (*User, error)

func (*User) Prepare

func (u *User) Prepare()

func (*User) SaveUser

func (u *User) SaveUser(db *gorm.DB) error

func (*User) UpdateAUser

func (u *User) UpdateAUser(db *gorm.DB, uid int) (*User, error)

Jump to

Keyboard shortcuts

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