db

package
v0.0.0-...-636fb15 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")
View Source
var ErrNameAlreadyExists = errors.New("name already exists")
View Source
var ErrReservedBucketName = errors.New("bucket name is reserved")
View Source
var RESERVED_BUCKET_NAMES = []string{
	"cis", "citypes", "cisbytype", "reltypes", "reltypeindex",
	"relsincoming", "relsoutgoing",
}

Functions

This section is empty.

Types

type ConfigurationItem

type ConfigurationItem struct {
	ID      string                `json:"id"`
	Version int                   `json:"version"`
	Data    map[string]string     `json:"data"`
	Type    ConfigurationItemType `json:"type"`
}

type ConfigurationItemType

type ConfigurationItemType struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type DB

type DB struct {
	*bolt.DB
}

func NewDB

func NewDB(path string) (*DB, error)

func (*DB) AddCI

func (db *DB) AddCI(data map[string]string) (*ConfigurationItem, error)

func (*DB) AddRelationship

func (db *DB) AddRelationship(from string, to string, relationship string, data map[string]string) (*Relationship, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) DeleteCI

func (db *DB) DeleteCI(id string) error

Delete the CI and all the relationships connected to it.

func (*DB) DeleteRelationship

func (db *DB) DeleteRelationship(id string) error

func (*DB) GetCI

func (db *DB) GetCI(id string) (ConfigurationItem, error)

func (*DB) GetCITypes

func (db *DB) GetCITypes() ([]ConfigurationItemType, error)

Get all CI types

func (*DB) GetCIsByType

func (db *DB) GetCIsByType(id string) ([]ConfigurationItem, error)

func (*DB) GetCis

func (db *DB) GetCis() ([]ConfigurationItem, error)

func (*DB) GetRelationship

func (db *DB) GetRelationship(id string) (*Relationship, error)

func (*DB) GetRelationshipTypes

func (db *DB) GetRelationshipTypes() ([]string, error)

Get all relationship types.

func (*DB) GetRelationships

func (db *DB) GetRelationships() ([]Relationship, error)

func (*DB) GetRelationshipsByCI

func (db *DB) GetRelationshipsByCI(id string) ([]Relationship, error)

Get all relationships attached to a given node.

func (*DB) GetRelationshipsByType

func (db *DB) GetRelationshipsByType(relationship string) ([]Relationship, error)

Get all relationships of a given type.

func (*DB) UpdateCI

func (db *DB) UpdateCI(id string, data map[string]string) error

Replace the labels on a node with the provided labels.

func (*DB) UpdateCITypeName

func (db *DB) UpdateCITypeName(id string, name string) error

Update name on CI type

func (*DB) UpdateRelationship

func (db *DB) UpdateRelationship(id string, data map[string]string) (*Relationship, error)

type Relationship

type Relationship struct {
	ID           string            `json:"id"`
	From         string            `json:"from"`
	To           string            `json:"to"`
	Relationship string            `json:"relationship"`
	Version      int               `json:"version"`
	Data         map[string]string `json:"data"`
}

Jump to

Keyboard shortcuts

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