data

package
v0.0.0-...-54eb79c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateURL

func CreateURL(db *sql.DB, url URL) error

func GetRootPath

func GetRootPath() string

func GetURLs

func GetURLs(db *sql.DB) (*[]URL, error)

func InitDb

func InitDb() *sql.DB

func IsURL

func IsURL(str string) bool

Validates that a string has a URL structure

func RandSeq

func RandSeq(n int) string

Creates a random sequence of characters for the URL code

func UpdateURL

func UpdateURL(db *sql.DB, url *URL) error

Types

type URL

type URL struct {
	Link        string `json:"link"`
	Code        string `json:"code"`
	Created     string `json:"created"`
	Visited     int    `json:"visited"`
	LastVisited string `json:"last_visited"`
}

func GetURLByCode

func GetURLByCode(db *sql.DB, code string) (*URL, error)
func GetURLByLink(db *sql.DB, link string) (*URL, error)

Jump to

Keyboard shortcuts

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