short_url

package module
v0.0.0-...-8546a7f Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SHortUrlCollection = "short_urls"

Variables

This section is empty.

Functions

func CreateUrl

func CreateUrl(ctx context.Context, urlStr string) (string, error)

Types

type DefaultKeyCreator

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

func NewDefaultKeyCreator

func NewDefaultKeyCreator() *DefaultKeyCreator

func (*DefaultKeyCreator) Create

func (k *DefaultKeyCreator) Create(ctx context.Context) string

type KeyCreator

type KeyCreator interface {
	Create(ctx context.Context) string
}

type ShortUrl

type ShortUrl struct {
	ddd.EntityBase[string] `bson:",inline"`
	Url                    string `bson:"url"`
	Key                    string `bson:"key"`
}

type ShortUrlInput

type ShortUrlInput struct {
	Url string `json:"url" binding:"required"`
}

type ShortUrlOutput

type ShortUrlOutput struct {
	Key string `json:"key"`
}

type ShortUrlRepository

type ShortUrlRepository interface {
	ddd.RepositoryBase[ShortUrl, string]

	GetUrl(ctx context.Context, key string) (*ShortUrl, error)
}

func NewMongoRepository

func NewMongoRepository() *ShortUrlRepository

Jump to

Keyboard shortcuts

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