mock

package
v0.0.0-...-03d5641 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MockLinkData []domain.Link = []domain.Link{
	{Id: "testid1", OriginalURL: "https://example.com/link1"},
	{Id: "testid2", OriginalURL: "https://example.com/link2"},
	{Id: "testid3", OriginalURL: "https://example.com/link3"},
}
View Source
var MockStatsData []domain.Stats = []domain.Stats{
	{Id: "abcdefg1", Platform: domain.PlatformUnknown, LinkID: "testid1"},
	{Id: "abcdefg2", Platform: domain.PlatformInstagram, LinkID: "testid2"},
	{Id: "abcdefg3", Platform: domain.PlatformTwitter, LinkID: "testid3"},
}

Functions

This section is empty.

Types

type MockLinkRepo

type MockLinkRepo struct {
	Links []domain.Link
	Stats []domain.Stats
}

func NewMockLinkRepo

func NewMockLinkRepo() *MockLinkRepo

func (*MockLinkRepo) All

func (m *MockLinkRepo) All(ctx context.Context) ([]domain.Link, error)

func (*MockLinkRepo) Create

func (m *MockLinkRepo) Create(ctx context.Context, link domain.Link) error

func (*MockLinkRepo) Delete

func (m *MockLinkRepo) Delete(ctx context.Context, id string) error

func (*MockLinkRepo) Get

func (m *MockLinkRepo) Get(ctx context.Context, id string) (domain.Link, error)

type MockRedisCache

type MockRedisCache struct {
	Store map[string]string
	TTL   map[string]time.Time
}

func NewMockRedisCache

func NewMockRedisCache() *MockRedisCache

func (*MockRedisCache) Delete

func (m *MockRedisCache) Delete(ctx context.Context, key string) error

func (*MockRedisCache) Get

func (m *MockRedisCache) Get(ctx context.Context, key string) (string, error)

func (*MockRedisCache) Set

func (m *MockRedisCache) Set(ctx context.Context, key string, val string) error

type MockStatsRepo

type MockStatsRepo struct {
	Stats []domain.Stats
}

func NewMockStatsRepo

func NewMockStatsRepo() *MockStatsRepo

func (*MockStatsRepo) All

func (m *MockStatsRepo) All(ctx context.Context) ([]domain.Stats, error)

func (*MockStatsRepo) Create

func (m *MockStatsRepo) Create(ctx context.Context, stats domain.Stats) error

func (*MockStatsRepo) Delete

func (m *MockStatsRepo) Delete(ctx context.Context, id string) error

func (*MockStatsRepo) Get

func (m *MockStatsRepo) Get(ctx context.Context, id string) (domain.Stats, error)

func (*MockStatsRepo) GetStatsByLinkID

func (m *MockStatsRepo) GetStatsByLinkID(ctx context.Context, linkID string) ([]domain.Stats, error)

Jump to

Keyboard shortcuts

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