model

package
v0.0.0-...-00a9c49 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TNVideo = "videos"

	CountPage = 20
)
View Source
const (
	TNUser = "users"
)

Variables

View Source
var (
	ErrDuplicateName = errors.New("duplicate name")
)

Functions

func CloseDB

func CloseDB() error

func InitDB

func InitDB(user, password, host, dbName string) error

Types

type User

type User struct {
	ID       int64
	Name     string
	Password string
}

func GetUser

func GetUser(id int) *User

func LoginCheck

func LoginCheck(name, password string) (*User, error)

func (*User) Insert

func (u *User) Insert() error

type Video

type Video struct {
	ID     int    `json:"id"`
	Title  string `json:"title"`
	Path   string `json:"path"`
	UserID int    `json:"user_id"`
}

func GetVideoByID

func GetVideoByID(id int) (*Video, error)

func GetVideos

func GetVideos(page int) ([]*Video, error)

func (*Video) Insert

func (v *Video) Insert() error

Jump to

Keyboard shortcuts

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