endpoint

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BucketName represents the name of the bucket where this service stores data.
	BucketName = "endpoint"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service represents a service for managing endpoint data.

func NewService

func NewService(db *bolt.DB) (*Service, error)

NewService creates a new instance of a service.

func (*Service) BatchUpdateEndpoints

func (service *Service) BatchUpdateEndpoints(endpoints ...model.Endpoint) error

BatchUpdateEndpoints ...

func (*Service) CreateDatabase added in v0.0.4

func (service *Service) CreateDatabase() (*bolt.Bucket, error)

CreateDatabase returns the next identifier for an endpoint.

func (*Service) CreateEndpoint

func (service *Service) CreateEndpoint(endpoint *model.Endpoint) error

CreateEndpoint assign an ID to a new endpoint and saves it.

func (*Service) DeleteEndpoint

func (service *Service) DeleteEndpoint(ID int) error

DeleteEndpoint deletes an endpoint.

func (*Service) Endpoint

func (service *Service) Endpoint(ID int) (*model.Endpoint, error)

Endpoint returns an endpoint by ID.

func (*Service) Endpoints

func (service *Service) Endpoints() ([]model.Endpoint, error)

Endpoints return an array containing all the endpoints.

func (*Service) GetNextIdentifier

func (service *Service) GetNextIdentifier() int

GetNextIdentifier returns the next identifier for an endpoint.

func (*Service) Synchronize

func (service *Service) Synchronize(toCreate, toUpdate, toDelete []*model.Endpoint) error

Synchronize creates, updates and deletes endpoints inside a single transaction.

func (*Service) TruncateDatabase added in v0.0.4

func (service *Service) TruncateDatabase() error

TruncateDatabase delete all data

func (*Service) UpdateEndpoint

func (service *Service) UpdateEndpoint(ID int, endpoint *model.Endpoint) error

UpdateEndpoint updates an endpoint.

Jump to

Keyboard shortcuts

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