shortlink

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 5 Imported by: 0

README

a short link go module.

Features

  • mysql db
    • support expire time
    • reuse expired shortlink path
  • redis cache
  • local cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShortLinkGenerator

type ShortLinkGenerator struct {
	// contains filtered or unexported fields
}

TODO: add redis cache and local cache

func GetShortLinkGenerator

func GetShortLinkGenerator() *ShortLinkGenerator
func (g *ShortLinkGenerator) DeleteShortLink(ctx context.Context, shortLinkPath string) error
func (g *ShortLinkGenerator) GenShortLink(ctx context.Context, rawLink string) (*db_base.ShortLink, error)

func (*ShortLinkGenerator) GenShortLinkWithExpire

func (g *ShortLinkGenerator) GenShortLinkWithExpire(ctx context.Context, rawLink string, expireAt time.Time) (*db_base.ShortLink, error)
func (g *ShortLinkGenerator) GetByRawLink(ctx context.Context, rawLink string) (*db_base.ShortLink, error)

func (*ShortLinkGenerator) GetByShortLinkPath

func (g *ShortLinkGenerator) GetByShortLinkPath(ctx context.Context, shortLinkPath string) (*db_base.ShortLink, error)

func (*ShortLinkGenerator) SetShortLinkExpire

func (g *ShortLinkGenerator) SetShortLinkExpire(ctx context.Context, shorLinkPath string, expireAt time.Time) error

func (*ShortLinkGenerator) WithMysql

Directories

Path Synopsis
dao

Jump to

Keyboard shortcuts

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