store

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2017 License: Apache-2.0 Imports: 11 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 {
}

func (*Destination) CountWhereGroupID

func (d *Destination) CountWhereGroupID(ctx context.Context, tx Transaction, group_id int) (int, error)

func (*Destination) Create

func (d *Destination) Create(ctx context.Context, tx Transaction, destination_group_id int, port int, protocol string) (int, error)

func (*Destination) Delete

func (d *Destination) Delete(ctx context.Context, tx Transaction, id int) error

func (*Destination) GetID

func (d *Destination) GetID(ctx context.Context, tx Transaction, destination_group_id int, port int, protocol string) (int, error)

type DestinationRepo

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

type Group

type Group struct {
}

func (*Group) Create

func (g *Group) Create(ctx context.Context, tx Transaction, guid string) (int, error)

func (*Group) Delete

func (g *Group) Delete(ctx context.Context, tx Transaction, id int) error

func (*Group) GetID

func (g *Group) GetID(ctx context.Context, tx Transaction, guid string) (int, error)

type GroupRepo

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

type MetricsWrapper added in v0.17.0

type MetricsWrapper struct {
	Store         Store
	MetricsSender metricsSender
}

func (*MetricsWrapper) All added in v0.17.0

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

func (*MetricsWrapper) ByGuids added in v0.17.0

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

func (*MetricsWrapper) Create added in v0.17.0

func (mw *MetricsWrapper) Create(ctx context.Context, policies []models.Policy) error

func (*MetricsWrapper) Delete added in v0.17.0

func (mw *MetricsWrapper) Delete(ctx context.Context, policies []models.Policy) error

func (*MetricsWrapper) Tags added in v0.17.0

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

type Policy

type Policy struct {
}

func (*Policy) CountWhereDestinationID

func (p *Policy) CountWhereDestinationID(ctx context.Context, tx Transaction, destination_id int) (int, error)

func (*Policy) CountWhereGroupID

func (p *Policy) CountWhereGroupID(ctx context.Context, tx Transaction, source_group_id int) (int, error)

func (*Policy) Create

func (p *Policy) Create(ctx context.Context, tx Transaction, source_group_id int, destination_id int) error

func (*Policy) Delete

func (p *Policy) Delete(ctx context.Context, tx Transaction, source_group_id int, destination_id int) error

type PolicyRepo

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

type Store

type Store interface {
	Create(context.Context, []models.Policy) error
	All() ([]models.Policy, error)
	Delete(context.Context, []models.Policy) error
	Tags() ([]models.Tag, error)
	ByGuids([]string, []string) ([]models.Policy, error)
}

func New

func New(dbConnectionPool db, g GroupRepo, d DestinationRepo, p PolicyRepo, tl int) (Store, error)

type Transaction

type Transaction interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	Commit() error
	Rollback() error
	Rebind(string) string
}

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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