model

package
v0.0.0-...-910d552 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBClose

func DBClose()

DBClose close

func InitDb

func InitDb()

InitDb init

func SoftDeletUrl

func SoftDeletUrl(id int) int

SoftDeletUrl delete url softy

func UpdateUrlByID

func UpdateUrlByID(id uint, url *Url) error

Types

type Url

type Url struct {
	gorm.Model
	Origin string `json:"origin" gorm:"type:varchar(255);not null"`
	Short  string `json:"short" gorm:"type:varchar(64);not null"`
}

func CheckUrlOrigin

func CheckUrlOrigin(origin string) (*Url, int)

CheckUrlOrigin check origin is existed

func CheckUrlShort

func CheckUrlShort(short string) (*Url, int)

CheckUrlShort check short is existed

func CreateUrl

func CreateUrl(url *Url) (*Url, error)

CreateUrl add a new url to database

func GetUrlByID

func GetUrlByID(id int) (*Url, error)

GetUrlByID search url with specified id

func GetUrlByOrigin

func GetUrlByOrigin(origin string) (*Url, error)

GetUrlByOrigin search url with specified id

func GetUrlByShort

func GetUrlByShort(short string) (*Url, error)

GetUrlByShort search url with specified id

func UrlList

func UrlList(pageSize int, pageNum int) ([]Url, int)

UrlList get url list in pageable

func (*Url) String

func (u *Url) String() string

Jump to

Keyboard shortcuts

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