model

package
v0.0.0-...-e8918d0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func DelPostByID

func DelPostByID(id int64) error

func DelUserByID

func DelUserByID(id int64) error

func NewPost

func NewPost(userID int64, content string) (int64, error)

func NewUser

func NewUser(username, password string) (int64, error)

func Setup

func Setup() error

func UpdPostByID

func UpdPostByID(id int64, content string) error

func UpdUserByID

func UpdUserByID(id int64, username, password string) error

func VerifyUserByUsernameAndPassword

func VerifyUserByUsernameAndPassword(username, password string) (int64, error)

Types

type Post

type Post struct {
	ID      int64  `gorm:"column:id;primary_key" json:"id"`
	UserID  int64  `gorm:"column:user_id" json:"user_id"`
	Content string `gorm:"column:content" json:"content"`
}

func GetPostByID

func GetPostByID(id int64) (Post, error)

type User

type User struct {
	ID       int64  `gorm:"column:id;primary_key" json:"id"`
	Username string `gorm:"column:username;unique" json:"username"`
	Password string `gorm:"column:password" json:"password"`
}

func GetUserByID

func GetUserByID(id int64) (User, error)

Jump to

Keyboard shortcuts

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