dev

package
v0.0.0-...-01bad0f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dev implements a GRPC server that reads and writes URLs to storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type URL

type URL struct {
	Storer storage.Storer

	Enricher func(from *url.URL, to *url.URL) error

	dev.UnimplementedManageURLsServer
}

URL is an implementation of the URL gRPC Server

func (URL) Get

func (u URL) Get(ctx context.Context, req *dev.GetRequest) (*dev.Response, error)

Get fetches a URL from storage

func (URL) New

func (u URL) New(ctx context.Context, req *dev.NewRequest) (*dev.Response, error)

New generates the "from" URL on the fly

type URLEnricher

type URLEnricher struct {
	Domain string
	Path   *uid.Generator
}

URLEnricher are defaults applied when the user doesn't supply that information.

func (*URLEnricher) Enrich

func (u *URLEnricher) Enrich(from *url.URL, to *url.URL) error

Enrich adds information to the provided URL if it is not already present.

Jump to

Keyboard shortcuts

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