meta

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package meta implements common data types, functions and variables specific to the meta package. The expectation is that this package should be used by meta packages and other packages that construct meta pointers for level 2+ error handling.

Index

Constants

View Source
const (
	EmployeeNotFound       string = "employee not found"
	EmployeeNotUpdated     string = "employee not updated"
	EmployeeNotCreated     string = "employee not created, email address not provided"
	EmployeeConflictCreate string = "cannot create employee; email address in use"
	EmployeeConflictUpdate string = "cannot update employee; email address in use"
)

these constants are used to generate employee specific errors

Variables

View Source
var (
	ErrEmployeeNotFound       = errors.NewNotFound(errors.New(EmployeeNotFound))
	ErrEmployeeNotUpdated     = errors.NewNotUpdated(errors.New(EmployeeNotUpdated))
	ErrEmployeeNotCreated     = errors.NewNotCreated(errors.New(EmployeeNotCreated))
	ErrEmployeeConflictCreate = errors.NewConflict(errors.New(EmployeeConflictCreate))
	ErrEmployeeConflictUpdate = errors.NewConflict(errors.New(EmployeeConflictUpdate))
)

these are error variables used within the employee meta

Functions

This section is empty.

Types

type Employee

type Employee interface {
	//EmployeeCreate can be used to create a single Employee
	// the employee email address is required and must be unique
	// at the time of creation
	EmployeeCreate(ctx context.Context, e data.EmployeePartial) (*data.Employee, error)

	//EmployeeRead can be used to read a single employee given a
	// valid id
	EmployeeRead(ctx context.Context, id string) (*data.Employee, error)

	//EmployeeUpdate can be used to update the properties of a given employee
	EmployeeUpdate(ctx context.Context, id string, e data.EmployeePartial) (*data.Employee, error)

	//EmployeeDelete can be used to delete a single employee given a
	// valid id
	EmployeeDelete(ctx context.Context, id string) error

	//EmployeesRead can be used to read one or more employees, given a set of
	// search parameters
	EmployeesRead(ctx context.Context, search data.EmployeeSearch) ([]*data.Employee, error)
}

Employee is an interface that groups functions to interact with one or more employees

type SerializedData

type SerializedData struct {
	Employees map[string]data.Employee `json:"employees"`
}

SerializedData provides a struct that describes the representation of the data when serialized

type Serializer

type Serializer interface {
	//Serialize can be used to convert all available metadata
	// to a single pointer to be used to serialize to bytes
	Serialize() (*SerializedData, error)

	//Deserialize can be used to provide metadata as a single pointer
	// once it's been deserialized from bytes
	Deserialize(data *SerializedData) error
}

Serializer is an interface that can be used to convert the contents of meta into a scalar type

Directories

Path Synopsis
Package file is a concrete implementation of the Employee interface defined in package Meta.
Package file is a concrete implementation of the Employee interface defined in package Meta.
Package file is a concrete implementation of the Employee interface defined in package Meta.
Package file is a concrete implementation of the Employee interface defined in package Meta.
Package mysql implements a concrete implementation of the Employee meta interface using the go database driver and mysql.
Package mysql implements a concrete implementation of the Employee meta interface using the go database driver and mysql.
Package tests provides a number of tests written against the Employee interface.
Package tests provides a number of tests written against the Employee interface.

Jump to

Keyboard shortcuts

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