model

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type URL

type URL struct {
	Key   string   `json:"key" sql:",pk"`
	URL   string   `json:"url"`
	Alias []string `json:"alias"`
	Views int      `json:"views" sql:"default:0"`
}

URL model

func (*URL) Find added in v0.1.0

func (u *URL) Find(key string) (*URL, error)

Find returns matching URL

func (*URL) GetMostPopular

func (u *URL) GetMostPopular(limit int) ([]*URL, error)

GetMostPopular gets the urls sorted by views

func (*URL) GetUrlsFromKeys

func (u *URL) GetUrlsFromKeys(keys []string) ([]*URL, error)

GetUrlsFromKeys returns all the db records that match the keys

func (*URL) IncrementViewCount

func (u *URL) IncrementViewCount(keys []string) error

IncrementViewCount increments the view count of all the keys passed in

func (*URL) Save

func (u *URL) Save() error

Save adds a new url to the db

func (*URL) Search

func (u *URL) Search(query string, limit int) ([]*URL, error)

Search returns all the db records that match the keys

func (*URL) Update

func (u *URL) Update() error

Update sets the new url and alias fields in the db

Jump to

Keyboard shortcuts

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