shortener

package
v0.0.0-...-3cf6f44 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockService

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

MockService is a mock of Service interface

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance

func (*MockService) CountRedirects

func (_m *MockService) CountRedirects(ctx context.Context, url string) (int64, *errors.Error)

CountRedirects mocks base method

func (*MockService) DeleteUrl

func (_m *MockService) DeleteUrl(ctx context.Context, url string) *errors.Error

DeleteUrl mocks base method

func (*MockService) EXPECT

func (_m *MockService) EXPECT() *MockServiceMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockService) IncrementRedirect

func (_m *MockService) IncrementRedirect(ctx context.Context, id string) (string, *errors.Error)

IncrementRedirect mocks base method

func (*MockService) RetrieveUrl

func (_m *MockService) RetrieveUrl(ctx context.Context, url string) (string, *errors.Error)

RetrieveUrl mocks base method

func (*MockService) ShortenUrl

func (_m *MockService) ShortenUrl(ctx context.Context, url string) (string, *errors.Error)

ShortenUrl mocks base method

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService

func (*MockServiceMockRecorder) CountRedirects

func (_mr *MockServiceMockRecorder) CountRedirects(arg0, arg1 interface{}) *gomock.Call

CountRedirects indicates an expected call of CountRedirects

func (*MockServiceMockRecorder) DeleteUrl

func (_mr *MockServiceMockRecorder) DeleteUrl(arg0, arg1 interface{}) *gomock.Call

DeleteUrl indicates an expected call of DeleteUrl

func (*MockServiceMockRecorder) IncrementRedirect

func (_mr *MockServiceMockRecorder) IncrementRedirect(arg0, arg1 interface{}) *gomock.Call

IncrementRedirect indicates an expected call of IncrementRedirect

func (*MockServiceMockRecorder) RetrieveUrl

func (_mr *MockServiceMockRecorder) RetrieveUrl(arg0, arg1 interface{}) *gomock.Call

RetrieveUrl indicates an expected call of RetrieveUrl

func (*MockServiceMockRecorder) ShortenUrl

func (_mr *MockServiceMockRecorder) ShortenUrl(arg0, arg1 interface{}) *gomock.Call

ShortenUrl indicates an expected call of ShortenUrl

type MockStore

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

MockStore is a mock of Store interface

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance

func (*MockStore) DeleteById

func (_m *MockStore) DeleteById(ctx context.Context, id string) error

DeleteById mocks base method

func (*MockStore) EXPECT

func (_m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockStore) FindById

func (_m *MockStore) FindById(ctx context.Context, id string) (*ModelShorten, error)

FindById mocks base method

func (*MockStore) FindUrl

func (_m *MockStore) FindUrl(ctx context.Context, url string) (*ModelShorten, error)

FindUrl mocks base method

func (*MockStore) IncrementCount

func (_m *MockStore) IncrementCount(ctx context.Context, id string) (*ModelShorten, error)

IncrementCount mocks base method

func (*MockStore) StoreUrl

func (_m *MockStore) StoreUrl(ctx context.Context, document interface{}) error

StoreUrl mocks base method

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore

func (*MockStoreMockRecorder) DeleteById

func (_mr *MockStoreMockRecorder) DeleteById(arg0, arg1 interface{}) *gomock.Call

DeleteById indicates an expected call of DeleteById

func (*MockStoreMockRecorder) FindById

func (_mr *MockStoreMockRecorder) FindById(arg0, arg1 interface{}) *gomock.Call

FindById indicates an expected call of FindById

func (*MockStoreMockRecorder) FindUrl

func (_mr *MockStoreMockRecorder) FindUrl(arg0, arg1 interface{}) *gomock.Call

FindUrl indicates an expected call of FindUrl

func (*MockStoreMockRecorder) IncrementCount

func (_mr *MockStoreMockRecorder) IncrementCount(arg0, arg1 interface{}) *gomock.Call

IncrementCount indicates an expected call of IncrementCount

func (*MockStoreMockRecorder) StoreUrl

func (_mr *MockStoreMockRecorder) StoreUrl(arg0, arg1 interface{}) *gomock.Call

StoreUrl indicates an expected call of StoreUrl

type ModelShorten

type ModelShorten struct {
	Id    string `json:"-" bson:"_id"`
	Url   string `json:"url" bson:"url"`
	Count int64  `json:"-" bson:"count"`
}

type Service

type Service interface {
	ShortenUrl(ctx context.Context, url string) (string, *errors.Error)
	RetrieveUrl(ctx context.Context, url string) (string, *errors.Error)
	DeleteUrl(ctx context.Context, url string) *errors.Error
	CountRedirects(ctx context.Context, url string) (int64, *errors.Error)
	IncrementRedirect(ctx context.Context, id string) (string, *errors.Error)
}

func NewService

func NewService(le *logrus.Logger, appConfig *config.AppConfig, store Store) Service

type Store

type Store interface {
	StoreUrl(ctx context.Context, document interface{}) error
	FindUrl(ctx context.Context, url string) (*ModelShorten, error)
	FindById(ctx context.Context, id string) (*ModelShorten, error)
	DeleteById(ctx context.Context, id string) error
	IncrementCount(ctx context.Context, id string) (*ModelShorten, error)
}

Jump to

Keyboard shortcuts

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