resource

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuditKeyResoruceBulkUpsert  = "resource.bulkUpsert"
	AuditKeyResourceUpdate      = "resource.update"
	AuditKeyResourceDelete      = "resource.delete"
	AuditKeyResourceBatchDelete = "resource.batchDelete"

	ReservedDetailsKeyMetadata = "__metadata"
)

Variables

View Source
var (
	// ErrEmptyIDParam is the error value if the resource id is empty
	ErrEmptyIDParam = errors.New("id can't be empty")
	// ErrRecordNotFound is the error value if the designated record id is not exists
	ErrRecordNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type Service

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

Service handles the business logic for resource

func NewService

func NewService(deps ServiceDeps) *Service

NewService returns *Service

func (*Service) BatchDelete

func (s *Service) BatchDelete(ctx context.Context, ids []string) error

func (*Service) BulkUpsert

func (s *Service) BulkUpsert(ctx context.Context, resources []*domain.Resource) error

BulkUpsert inserts or updates records

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) Find

Find records based on filters

func (*Service) Get

func (*Service) GetOne

func (s *Service) GetOne(ctx context.Context, id string) (*domain.Resource, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, r *domain.Resource) error

Update updates only details and labels of a resource by ID

type ServiceDeps

type ServiceDeps struct {
	Repository repository

	Logger      log.Logger
	AuditLogger auditLogger
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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