serviceinterface

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainService

type DomainService interface {
	// ListDomains returns paginated domain entries with pagination metadata.
	// page and perPage are 1-based. If page is 0 or negative, it defaults to 1.
	// If perPage is 0 or negative, it defaults to DefaultPerPage (100).
	// If perPage exceeds MaxPerPage (1000), it is capped to MaxPerPage.
	// sortOrder can be "asc" or "desc" to sort by domain field (optional - defaults to alphabetical order).
	// search is an optional search term to filter domains by domain field using contains().
	ListDomains(page, perPage int, sortOrder, search string) ([]*model.DomainEntry, *model.PaginationInfo, error)

	// GetDomain retrieves a specific domain entry by its domain name.
	// If multiple entries exist with the same domain, returns the first match.
	GetDomain(domain, alias string) (*model.DomainEntry, error)

	// CreateDomain creates a new domain entry with the given configuration.
	CreateDomain(req *model.CreateDomainRequest) (*model.DomainEntry, error)

	// UpdateDomain updates an existing domain entry with the given configuration.
	UpdateDomain(domain string, req model.UpdateDomainRequest) (*model.DomainEntry, error)

	// DeleteDomain removes a domain entry by its domain name.
	DeleteDomain(domain string, req model.DeleteDomainRequest) error

	// Close performs any necessary cleanup when the service is no longer needed.
	Close() error
}

DomainService defines the interface for domain operations. It provides methods for managing domain entries in the dehydrated configuration.

type MockDomainService added in v0.2.0

type MockDomainService struct{}

MockDomainService implements the DomainService interface for testing. It provides a simple in-memory implementation of domain operations that returns successful responses.

func (*MockDomainService) Close added in v0.2.0

func (m *MockDomainService) Close() error

Close performs cleanup for the mock service.

func (*MockDomainService) CreateDomain added in v0.2.0

CreateDomain creates a mock domain entry for testing.

func (*MockDomainService) DeleteDomain added in v0.2.0

func (m *MockDomainService) DeleteDomain(_ string, _ model.DeleteDomainRequest) error

DeleteDomain simulates deleting a domain entry for testing.

func (*MockDomainService) GetDomain added in v0.2.0

func (m *MockDomainService) GetDomain(domain, _ string) (*model.DomainEntry, error)

GetDomain returns a mock domain entry for testing.

func (*MockDomainService) ListDomains added in v0.2.0

func (m *MockDomainService) ListDomains(page, perPage int, sortOrder, search string) ([]*model.DomainEntry, *model.PaginationInfo, error)

ListDomains returns an empty list of domains for testing.

func (*MockDomainService) UpdateDomain added in v0.2.0

func (m *MockDomainService) UpdateDomain(domain string, _ model.UpdateDomainRequest) (*model.DomainEntry, error)

UpdateDomain updates a mock domain entry for testing.

type MockErrDomainService

type MockErrDomainService struct{}

MockErrDomainService implements the DomainService interface for testing. It provides a simple in-memory implementation of domain operations.

func (*MockErrDomainService) Close

func (m *MockErrDomainService) Close() error

Close performs cleanup for the mock service.

func (*MockErrDomainService) CreateDomain

CreateDomain creates a mock domain entry for testing.

func (*MockErrDomainService) DeleteDomain

DeleteDomain simulates deleting a domain entry for testing.

func (*MockErrDomainService) GetDomain

func (m *MockErrDomainService) GetDomain(_, _ string) (*model.DomainEntry, error)

GetDomain returns a mock domain entry for testing.

func (*MockErrDomainService) ListDomains

func (m *MockErrDomainService) ListDomains(page, perPage int, sortOrder, search string) ([]*model.DomainEntry, *model.PaginationInfo, error)

ListDomains returns an empty list of domains for testing.

func (*MockErrDomainService) UpdateDomain

UpdateDomain updates a mock domain entry for testing.

Jump to

Keyboard shortcuts

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