mock

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextStore

type ContextStore struct {
	Store     *mockstorage.MockStore
	ErrGet    error
	ErrPut    error
	ErrImport error
	ErrDelete error
}

ContextStore is a mock JSON-LD context store.

func NewMockContextStore

func NewMockContextStore() *ContextStore

NewMockContextStore returns a new instance of ContextStore.

func (*ContextStore) Delete

func (s *ContextStore) Delete(documents []context.Document) error

Delete deletes context documents in the underlying storage.

func (*ContextStore) Get

Get returns JSON-LD remote document from the underlying storage by context url.

func (*ContextStore) Import

func (s *ContextStore) Import(documents []context.Document) error

Import imports contexts into the underlying storage.

func (*ContextStore) Put

Put saves JSON-LD remote document into the underlying storage under key u (context url).

type RemoteProviderStore

type RemoteProviderStore struct {
	Store     *mockstorage.MockStore
	ErrGet    error
	ErrGetAll error
	ErrSave   error
	ErrDelete error
}

RemoteProviderStore is a mock remote JSON-LD context provider store.

func NewMockRemoteProviderStore

func NewMockRemoteProviderStore() *RemoteProviderStore

NewMockRemoteProviderStore returns a new instance of RemoteProviderStore.

func (*RemoteProviderStore) Delete

func (s *RemoteProviderStore) Delete(id string) error

Delete deletes a remote provider record in the underlying storage.

func (*RemoteProviderStore) Get

Get returns a remote provider record from the underlying storage.

func (*RemoteProviderStore) GetAll

GetAll returns all remote provider records from the underlying storage.

func (*RemoteProviderStore) Save

Save creates a new remote provider record and saves it to the underlying storage. If the record with specified endpoint already exists it is returned to the caller.

type Service

type Service struct {
	ProviderID                   string
	RemoteProviderRecords        []store.RemoteProviderRecord
	ErrAddContexts               error
	ErrAddRemoteProvider         error
	ErrRefreshRemoteProvider     error
	ErrDeleteRemoteProvider      error
	ErrGetAllRemoteProviders     error
	ErrRefreshAllRemoteProviders error
}

Service is a mock JSON-LD service.

func (*Service) AddContexts

func (s *Service) AddContexts(documents []context.Document) error

AddContexts adds JSON-LD contexts to the underlying storage.

func (*Service) AddRemoteProvider

func (s *Service) AddRemoteProvider(providerEndpoint string, opts ...remote.ProviderOpt) (string, error)

AddRemoteProvider adds remote provider and JSON-LD contexts from that provider.

func (*Service) DeleteRemoteProvider

func (s *Service) DeleteRemoteProvider(providerID string, opts ...remote.ProviderOpt) error

DeleteRemoteProvider deletes remote provider and contexts from that provider.

func (*Service) GetAllRemoteProviders

func (s *Service) GetAllRemoteProviders() ([]store.RemoteProviderRecord, error)

GetAllRemoteProviders gets all remote providers.

func (*Service) RefreshAllRemoteProviders

func (s *Service) RefreshAllRemoteProviders(opts ...remote.ProviderOpt) error

RefreshAllRemoteProviders updates contexts from all remote providers.

func (*Service) RefreshRemoteProvider

func (s *Service) RefreshRemoteProvider(providerID string, opts ...remote.ProviderOpt) error

RefreshRemoteProvider updates contexts from the remote provider.

Jump to

Keyboard shortcuts

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