registry

package
v0.0.0-...-d3d53d6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUsernameAndGlobalIDAreMutuallyExclusive = errors.New("Username and globalid can not both be specified")

ErrUsernameAndGlobalIDAreMutuallyExclusive is the error given when both a username and a globalid were given

View Source
var ErrUsernameOrGlobalIDRequired = errors.New("Username or globalid is required")

ErrUsernameOrGlobalIDRequired is used to indicate that no username of globalid were specified

Functions

func InitModels

func InitModels()

InitModels initialize models in mongo, if required.

Types

type Manager

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

Manager is used to store KeyValuePairs in a user or organization registry

func NewManager

func NewManager(r *http.Request) *Manager

NewManager creates and initializes a new Manager

func (*Manager) DeleteRegistryEntry

func (m *Manager) DeleteRegistryEntry(username string, globalid string, key string) (err error)

DeleteRegistryEntry deletes a registry entry Either a username or a globalid needs to be given If the key does not exist, no error is returned

func (*Manager) GetRegistryEntry

func (m *Manager) GetRegistryEntry(username string, globalid string, key string) (registryEntry *RegistryEntry, err error)

GetRegistryEntry gets a registryentry for a user or organization If no such entry exists, nil is returned, both for the registryEntry and error

func (*Manager) ListRegistryEntries

func (m *Manager) ListRegistryEntries(username string, globalid string) (registryEntries []RegistryEntry, err error)

ListRegistryEntries gets all registry entries for a user or organization

func (*Manager) UpsertRegistryEntry

func (m *Manager) UpsertRegistryEntry(username string, globalid string, registryEntry RegistryEntry) (err error)

UpsertRegistryEntry updates or inserts a registry entry Either a username or a globalid needs to be given

type RegistryEntry

type RegistryEntry struct {
	Key   string `json:"Key" validate:"min=1,max=256,nonzero"`
	Value string `json:"Value" validate:"max=1024,nonzero"`
}

RegistryEntry is a key-pair in a user or organization registry

func (RegistryEntry) Validate

func (s RegistryEntry) Validate() error

Validate checks if the RegistryEntry is valid

Jump to

Keyboard shortcuts

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