links

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLinkNotFound      = errors.New("link not found")
	ErrLinkAlreadyExists = errors.New("link already exists")
)
View Source
var Module = fx.Module(
	"links",
	fx.Decorate(func(log *zap.Logger) *zap.Logger {
		return log.Named("api")
	}),
	fx.Provide(newRepository, fx.Private),
	fx.Provide(NewService),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Hostname string
	TTL      time.Duration
}
type NewLink struct {
	// contains filtered or unexported fields
}
func NewNewLink(targetUrl string) NewLink

func (NewLink) TargetURL added in v0.4.0

func (n NewLink) TargetURL() string

func (NewLink) Validate added in v0.4.0

func (n NewLink) Validate() error

type Service added in v0.4.0

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

func NewService added in v0.4.0

func NewService(
	idgen *id.Generator,
	links *repository,
	logger *zap.Logger,
	config Config,
) *Service

func (*Service) Create added in v0.4.0

func (s *Service) Create(ctx context.Context, target NewLink) (api.Link, error)

func (*Service) Get added in v0.4.0

func (s *Service) Get(ctx context.Context, id string) (api.Link, error)

func (*Service) GetTarget added in v0.4.0

func (s *Service) GetTarget(ctx context.Context, id string) (string, error)

func (*Service) ValidateID added in v0.4.0

func (s *Service) ValidateID(id string) error

type ValidationError

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

func AsValidationError

func AsValidationError(err error) *ValidationError

func (ValidationError) Error

func (v ValidationError) Error() string

func (ValidationError) Unwrap

func (v ValidationError) Unwrap() error

Jump to

Keyboard shortcuts

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