domains

package
v0.0.0-...-f2fa0db Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockRepository

func NewMockRepository() *mockRepository

func ValidateCreateRequest

func ValidateCreateRequest(c *auth.CreateDomainRequest) error

ValidateCreateRequest validates the CreateDomainRequest fields.

func ValidateUpdateRequest

func ValidateUpdateRequest(u *auth.UpdateDomainRequest) error

Validate validates the UpdateDomainRequest fields.

Types

type API

type API interface {
	grpcgw.Controller
}

func New

func New(srv Service) API

type Repository

type Repository interface {
	// Get returns the domain with the specified domain UUID.
	Get(ctx context.Context, uuid string) (entity.Domain, error)
	// GetByName returns the domain with the specified domain name.
	GetByName(ctx context.Context, name string) (entity.Domain, error)
	// Count returns the number of domains.
	Count(ctx context.Context) (int64, error)
	// Query returns the list of domains with the given offset and limit.
	Query(ctx context.Context, query string, offset, limit int64) ([]entity.Domain, int, error)
	// Create saves a new domain in the storage.
	Create(ctx context.Context, domain entity.Domain) (string, error)
	// Update updates the domain with given UUID in the storage.
	Update(ctx context.Context, domain entity.Domain) error
	// Delete removes the domain with given UUID from the storage.
	Delete(ctx context.Context, domain entity.Domain) error
}

Repository encapsulates the logic to access domains from the data source.

func NewRepository

func NewRepository(db *db.DB) Repository

NewRepository creates a new domain repository

type Service

type Service interface {
	Get(ctx context.Context, uuid string) (*auth.Domain, error)
	Query(ctx context.Context, query string, offset, limit int64) (*auth.ListDomainsResponse, error)
	Count(ctx context.Context) (int64, error)
	Create(ctx context.Context, input *auth.CreateDomainRequest) (*auth.Domain, error)
	Update(ctx context.Context, input *auth.UpdateDomainRequest) (*auth.Domain, error)
	Delete(ctx context.Context, uuid string) (*auth.Domain, error)
}

Service encapsulates use case logic for domains.

func NewService

func NewService(repo Repository) Service

NewService creates a new domain service.

Jump to

Keyboard shortcuts

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