repository

package
v0.0.0-...-2ae5639 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IUZRepository

type IUZRepository interface {
	Initialize() error
	Save(longPath, shortPath string) error
	GetFullURL(shortPath string) (string, error)
}

func Connect

func Connect(cfg config.Config) (IUZRepository, error)

Connect to the database

type Relation

type Relation struct {
	ID        uint64    `gorm:"primaryKey;autoIncrement:true"`
	ShortPath string    `gorm:"column:short_path;index;unique;comment:generated short url"`
	FullPath  string    `gorm:"column:full_path;comment:source full url"`
	Created   time.Time `gorm:"<-:create;index;default:current_timestamp"`
}

type UrlZipDatabase

type UrlZipDatabase struct {
	*gorm.DB
}

UrlZipDatabase represents a database

func (*UrlZipDatabase) GetFullURL

func (d *UrlZipDatabase) GetFullURL(shortPath string) (string, error)

func (*UrlZipDatabase) Initialize

func (d *UrlZipDatabase) Initialize() error

Initialize ...

func (*UrlZipDatabase) Save

func (d *UrlZipDatabase) Save(fullPath, shortPath string) error

Save saves the pair of urls to database

Jump to

Keyboard shortcuts

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