models

package
v0.0.0-...-b8f4d2c Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ValidChars = "bcdfghmnprstvz23456789"

Variables

This section is empty.

Functions

func IDfromShortURI

func IDfromShortURI(uri string) int64

func ShortURIfromID

func ShortURIfromID(id int64) string

Types

type AliasLink Link

type Host

type Host struct {
	URL string
}

func NewHost

func NewHost(url string) *Host

func (*Host) IsValid

func (h *Host) IsValid() error
type Link struct {
	ID        int64     `json:"-"`
	URL       string    `json:"url"`
	CreatedBy string    `json:"-"`
	CreatedAt time.Time `json:"created_at"`
}

func (*Link) MarshalJSON

func (link *Link) MarshalJSON() ([]byte, error)

func (*Link) UnmarshalJSON

func (link *Link) UnmarshalJSON(data []byte) error

func (*Link) Validate

func (l *Link) Validate() error
type Links struct {
	// contains filtered or unexported fields
}
func NewLinks(services *services.Services) *Links

func (*Links) Create

func (ls *Links) Create(l *Link) (*Link, error)

func (*Links) FindByID

func (ls *Links) FindByID(id int64) (*Link, error)

func (*Links) FindByShortURI

func (ls *Links) FindByShortURI(shortURI string) (*Link, error)

func (*Links) FindByURL

func (ls *Links) FindByURL(URL string) (*Link, error)
type PublicLink struct {
	ShortURI string `json:"short_uri"`
	*AliasLink
}

Jump to

Keyboard shortcuts

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