db

package
v0.0.0-...-a12d4bf Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// TableFabric is the table for storing switch and pod ids
	TableFabric = "ACI-Fabric"
	// TableSwitch is the table for storing switch information
	TableSwitch = "ACI-Switch"
	// TableSwitchChassis is the table for storing switch chassis information
	TableSwitchChassis = "ACI-SwitchChassis"
	// TableSwitchPorts is the table for storing ports of each switch
	TableSwitchPorts = "ACI-SwitchPorts"
	// TablePort is the table for storing port information
	TablePort = "ACI-Port"
	// TableZone is the table for storing zone information
	TableZone = "ACI-Zone"
	// TableAddressPool is the table for storing addresspool information
	TableAddressPool = "ACI-AddressPool"
	// TableEndPoint is the table for storing fabric endpoint information
	TableEndPoint = "ACI-EndPoint"
	// TableZoneDomain is the table for storing ZoneToDomainDN information
	TableZoneDomain = "ACI-ZoneDomain"
)

Variables

View Source
var (
	// ErrorServiceUnavailable is for identifing DB connection errors
	ErrorServiceUnavailable = errors.New("Failed to establish connection with the DB")
	// ErrorKeyAlreadyExist is for identifing already exist error
	ErrorKeyAlreadyExist = errors.New("Key already exist in DB")
	// ErrorKeyNotFound is for identifing not found error
	ErrorKeyNotFound = errors.New("Key not Found in DB")
)

Using below variables as part of errors will enabling errors.Is() function

View Source
var Connector dbCalls

Connector is the interface which connects the DB functions

Functions

This section is empty.

Types

type Client

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

Client is the established connection

type Config

type Config struct {
	Port         string
	Protocol     string
	Host         string
	SentinelHost string
	SentinelPort string
	MasterSet    string
	Password     string
}

Config is the configuration for db which is set by the wrapper package.

Port is the port number for the database connection Protocol is the type of protocol with which the connection takes place Host is hostname/IP on which the database is running

type MockConnector

type MockConnector struct{}

MockConnector is for mocking DB connector interface

func (MockConnector) Create

func (d MockConnector) Create(table, resourceID, data string) error

Create is for mocking DB Create operation

func (MockConnector) Delete

func (d MockConnector) Delete(table, resourceID string) (err error)

Delete is for mocking DB Delete operation

func (MockConnector) DeleteKeySetMembers

func (d MockConnector) DeleteKeySetMembers(key string, member string) (err error)

DeleteKeySetMembers is for mocking DB SREM operation

func (MockConnector) Get

func (d MockConnector) Get(table, resourceID string) (string, error)

Get is for mocking DB Get operation

func (MockConnector) GetAllMatchingKeys

func (d MockConnector) GetAllMatchingKeys(table, pattern string) ([]string, error)

GetAllMatchingKeys is for mocking GetAllMatchingKeys operation

func (MockConnector) GetKeySetMembers

func (d MockConnector) GetKeySetMembers(key string) (list []string, err error)

GetKeySetMembers is for mocking DB SMEMBERS operation

func (MockConnector) Update

func (d MockConnector) Update(table, resourceID, data string) error

Update is for mocking DB Update operation

func (MockConnector) UpdateKeySet

func (d MockConnector) UpdateKeySet(key string, member string) (err error)

UpdateKeySet is for mocking DB SADD operation

type RedisExternalCalls

type RedisExternalCalls interface {
	// contains filtered or unexported methods
}

RedisExternalCalls containes the methods to make calls to external client libraries of Redis DB

Jump to

Keyboard shortcuts

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