api

package
v0.0.0-...-85caf32 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockUrlStore

type MockUrlStore struct {
	mock.Mock
}

MockUrlStore is an autogenerated mock type for the UrlStore type

func NewMockUrlStore

func NewMockUrlStore(t mockConstructorTestingTNewMockUrlStore) *MockUrlStore

NewMockUrlStore creates a new instance of MockUrlStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockUrlStore) CheckIfExists

func (_m *MockUrlStore) CheckIfExists(_a0 context.Context, _a1 string) (bool, error)

CheckIfExists provides a mock function with given fields: _a0, _a1

func (*MockUrlStore) Create

func (_m *MockUrlStore) Create(_a0 context.Context, _a1 UrlInfo) error

Create provides a mock function with given fields: _a0, _a1

func (*MockUrlStore) Get

func (_m *MockUrlStore) Get(_a0 context.Context, _a1 string, _a2 string) (string, error)

Get provides a mock function with given fields: _a0, _a1, _a2

type UrlInfo

type UrlInfo struct {
	Original     string `json:"orginal"`
	Shortened    string `json:"shotened"`
	CreationTime int64  `json:"creation_time"`
}

type UrlService

type UrlService interface {
	Generate(context.Context, UrlStruct) (UrlStruct, error)

	Get(context.Context, UrlStruct) (UrlStruct, error)
}

func NewUrlService

func NewUrlService(urlStore UrlStore, ig *indigo.Generator) UrlService

type UrlStore

type UrlStore interface {
	CheckIfExists(context.Context, string) (bool, error)

	Create(context.Context, UrlInfo) error

	Get(context.Context, string, string) (string, error)
}

type UrlStruct

type UrlStruct struct {
	Url string `json:"url"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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