Documentation ¶
Index ¶
- func CreateLink(database *sql.DB, identifier uuid.UUID, createdAt time.Time, ...) error
- func CreateLinksTable(database *sql.DB, maxShort int) error
- func DBConnect(dbType, dbURL string) (*sql.DB, error)
- func GetHashByShort(db *sql.DB, short string) (string, error)
- func GetURLByShort(db *sql.DB, short string) (string, error)
- func RemoveLink(db *sql.DB, short string) error
- type Link
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLink ¶
func CreateLink( database *sql.DB, identifier uuid.UUID, createdAt time.Time, expireAt time.Time, url, short, password string, ) error
CreateLink inserts a link entry in the links table.
func CreateLinksTable ¶
CreateLinksTable creates the links table in the database.
func DBConnect ¶
DBConnect tries to connect to database using given driver and db url, error if it can't.
func GetHashByShort ¶
GetHashByShort gets a hash from a link entry by its value of the short column.
func GetURLByShort ¶
GetURLByShort gets a link entry from the links table by its value of the short column.
Types ¶
Click to show internal directories.
Click to hide internal directories.