Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_TAG_LENGTH = 3
View Source
const MIN_TAG_LENGTH = 1

Variables

View Source
var RecordNotFoundError = errors.New("record not found")

Functions

This section is empty.

Types

type Destination

type Destination struct {
	ID       string
	Tag      string
	Protocol string
	Port     int
	Ports    Ports
}

type DestinationRepo

type DestinationRepo interface {
	Create(Transaction, int, int, int, int, string) (int, error)
	Delete(Transaction, int) error
	GetID(Transaction, int, int, int, int, string) (int, error)
	CountWhereGroupID(Transaction, int) (int, error)
}

type DestinationTable

type DestinationTable struct {
}

func (*DestinationTable) CountWhereGroupID

func (d *DestinationTable) CountWhereGroupID(tx Transaction, group_id int) (int, error)

func (*DestinationTable) Create

func (d *DestinationTable) Create(tx Transaction, destination_group_id, port, startPort, endPort int, protocol string) (int, error)

func (*DestinationTable) Delete

func (d *DestinationTable) Delete(tx Transaction, id int) error

func (*DestinationTable) GetID

func (d *DestinationTable) GetID(tx Transaction, destination_group_id, port, startPort, endPort int, protocol string) (int, error)

type GroupRepo

type GroupRepo interface {
	Create(Transaction, string) (int, error)
	Delete(Transaction, int) error
	GetID(Transaction, string) (int, error)
}

type GroupTable

type GroupTable struct {
}

func (*GroupTable) Create

func (g *GroupTable) Create(tx Transaction, guid string) (int, error)

func (*GroupTable) Delete

func (g *GroupTable) Delete(tx Transaction, id int) error

func (*GroupTable) GetID

func (g *GroupTable) GetID(tx Transaction, guid string) (int, error)

type MetricsWrapper

type MetricsWrapper struct {
	Store         Store
	MetricsSender metricsSender
}

func (*MetricsWrapper) All

func (mw *MetricsWrapper) All() ([]Policy, error)

func (*MetricsWrapper) ByGuids

func (mw *MetricsWrapper) ByGuids(srcGuids, dstGuids []string) ([]Policy, error)

func (*MetricsWrapper) CheckDatabase

func (mw *MetricsWrapper) CheckDatabase() error

func (*MetricsWrapper) Create

func (mw *MetricsWrapper) Create(policies []Policy) error

func (*MetricsWrapper) Delete

func (mw *MetricsWrapper) Delete(policies []Policy) error

func (*MetricsWrapper) Tags

func (mw *MetricsWrapper) Tags() ([]Tag, error)

type Migrator

type Migrator interface {
	PerformMigrations(driverName string, migrationDb migrations.MigrationDb, maxNumMigrations int) (int, error)
}

type Policy

type Policy struct {
	Source      Source
	Destination Destination
}

type PolicyRepo

type PolicyRepo interface {
	Create(Transaction, int, int) error
	Delete(Transaction, int, int) error
	CountWhereGroupID(Transaction, int) (int, error)
	CountWhereDestinationID(Transaction, int) (int, error)
}

type PolicyTable

type PolicyTable struct {
}

func (*PolicyTable) CountWhereDestinationID

func (p *PolicyTable) CountWhereDestinationID(tx Transaction, destination_id int) (int, error)

func (*PolicyTable) CountWhereGroupID

func (p *PolicyTable) CountWhereGroupID(tx Transaction, source_group_id int) (int, error)

func (*PolicyTable) Create

func (p *PolicyTable) Create(tx Transaction, source_group_id int, destination_id int) error

func (*PolicyTable) Delete

func (p *PolicyTable) Delete(tx Transaction, source_group_id int, destination_id int) error

type Ports

type Ports struct {
	Start int
	End   int
}

type Source

type Source struct {
	ID  string
	Tag string
}

type Store

type Store interface {
	Create([]Policy) error
	All() ([]Policy, error)
	Delete([]Policy) error
	Tags() ([]Tag, error)
	ByGuids([]string, []string) ([]Policy, error)
	CheckDatabase() error
}

func New

func New(dbConnectionPool db, migrationDbConnectionPool db, g GroupRepo, d DestinationRepo, p PolicyRepo, tl int, t time.Duration, migrator Migrator) (Store, error)

type Tag

type Tag struct {
	ID  string
	Tag string
}

type Transaction

type Transaction interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	Commit() error
	Rollback() error
	Rebind(string) string
	DriverName() string
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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