db

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 2 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TCP_MAPPING_BASE_KEY  string = "/v1/tcp_routes/router_groups"
	HTTP_ROUTE_BASE_KEY   string = "/routes"
	ROUTER_GROUP_BASE_KEY string = "/v1/router_groups"

	TCP_WATCH          string = "tcp-watch"
	HTTP_WATCH         string = "http-watch"
	ROUTER_GROUP_WATCH string = "router-group-watch"
)
View Source
const (
	KeyNotFound       = "KeyNotFound"
	NonUpdatableField = "NonUpdatableField"
	UniqueField       = "UniqueField"
)
View Source
const (
	InvalidEvent = EventType(iota)
	CreateEvent
	DeleteEvent
	ExpireEvent
	UpdateEvent
)

Variables

View Source
var DeleteRouteError = DBError{Type: KeyNotFound, Message: "Delete Fails: Route does not exist"}
View Source
var DeleteRouterGroupError = DBError{Type: KeyNotFound, Message: "Delete Fails: Router Group does not exist"}

Functions

func ConnectionString

func ConnectionString(cfg *config.SqlDB) (string, error)

func VerifyCertificatesIgnoreHostname

func VerifyCertificatesIgnoreHostname(rawCerts [][]byte, caCertPool *x509.CertPool) error

Types

type Client

type Client interface {
	Close() error
	Where(query interface{}, args ...interface{}) Client
	Create(value interface{}) (int64, error)
	Delete(value interface{}, where ...interface{}) (int64, error)
	Save(value interface{}) (int64, error)
	Update(column string, value interface{}) (int64, error)
	First(out interface{}, where ...interface{}) error
	Find(out interface{}, where ...interface{}) error
	AutoMigrate(values ...interface{}) error
	Begin() Client
	Rollback() error
	Commit() error
	HasTable(value interface{}) bool
	AddUniqueIndex(indexName string, columns interface{}) error
	RemoveIndex(indexName string, columns interface{}) error
	Model(value interface{}) Client
	Exec(query string, args ...interface{}) int64
	ExecWithError(query string, args ...interface{}) error
	Rows(tableName string) (*sql.Rows, error)
	DropColumn(column string) error
	Dialect() gorm.Dialector
	Migrator() gorm.Migrator
}

func NewGormClient

func NewGormClient(db *gorm.DB) Client

type DB

type DB interface {
	ReadRoutes() ([]models.Route, error)
	SaveRoute(route models.Route) error
	DeleteRoute(route models.Route) error

	ReadTcpRouteMappings() ([]models.TcpRouteMapping, error)
	ReadFilteredTcpRouteMappings(columnName string, values []string) ([]models.TcpRouteMapping, error)
	FindSimilarTcpRouteMappings(sniHostname string, externalPort uint16) ([]models.TcpRouteMapping, error)
	SaveTcpRouteMapping(tcpMapping models.TcpRouteMapping) error
	DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error

	ReadRouterGroups() (models.RouterGroups, error)
	ReadRouterGroup(guid string) (models.RouterGroup, error)
	DeleteRouterGroup(guid string) error
	ReadRouterGroupByName(name string) (models.RouterGroup, error)
	SaveRouterGroup(routerGroup models.RouterGroup) error

	CancelWatches()
	WatchChanges(watchType string) (<-chan Event, <-chan error, context.CancelFunc)

	LockRouterGroupReads()
	LockRouterGroupWrites()
	UnlockRouterGroupReads()
	UnlockRouterGroupWrites()
}

type DBError

type DBError struct {
	Type    string
	Message string
}

func (DBError) Error

func (err DBError) Error() string

type Event

type Event struct {
	Type  EventType
	Value string
}

func NewEventFromInterface

func NewEventFromInterface(eventType EventType, obj interface{}) (Event, error)

type EventType

type EventType int

func (EventType) String

func (e EventType) String() string

type MySQLAdapter

type MySQLAdapter struct{}

func (*MySQLAdapter) RegisterTLSConfig

func (m *MySQLAdapter) RegisterTLSConfig(key string, config *tls.Config) error

type MySQLConnectionStringBuilder

type MySQLConnectionStringBuilder struct {
	MySQLAdapter mySQLAdapter
}

func (*MySQLConnectionStringBuilder) Build

type SqlDB

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

func NewSqlDB

func NewSqlDB(cfg *config.SqlDB) (*SqlDB, error)

func (*SqlDB) CancelWatches

func (s *SqlDB) CancelWatches()

func (*SqlDB) CleanupRoutes

func (s *SqlDB) CleanupRoutes(logger lager.Logger, pruningInterval time.Duration, signals <-chan os.Signal)

func (*SqlDB) Connect

func (s *SqlDB) Connect() error

func (*SqlDB) DeleteRoute

func (s *SqlDB) DeleteRoute(route models.Route) error

func (*SqlDB) DeleteRouterGroup

func (s *SqlDB) DeleteRouterGroup(guid string) error

func (*SqlDB) DeleteTcpRouteMapping

func (s *SqlDB) DeleteTcpRouteMapping(tcpMapping models.TcpRouteMapping) error

func (*SqlDB) FindExistingTcpRouteMapping

func (s *SqlDB) FindExistingTcpRouteMapping(tcpMapping models.TcpRouteMapping) (models.TcpRouteMapping, error)

func (*SqlDB) FindExpiredRoutes

func (s *SqlDB) FindExpiredRoutes(routes interface{}, c clock.Clock) error

func (*SqlDB) FindSimilarTcpRouteMappings

func (s *SqlDB) FindSimilarTcpRouteMappings(sniHostname string, externalPort uint16) ([]models.TcpRouteMapping, error)

func (*SqlDB) LockRouterGroupReads

func (s *SqlDB) LockRouterGroupReads()

func (*SqlDB) LockRouterGroupWrites

func (s *SqlDB) LockRouterGroupWrites()

func (*SqlDB) ReadFilteredTcpRouteMappings

func (s *SqlDB) ReadFilteredTcpRouteMappings(columnName string, values []string) ([]models.TcpRouteMapping, error)

func (*SqlDB) ReadRouterGroup

func (s *SqlDB) ReadRouterGroup(guid string) (models.RouterGroup, error)

func (*SqlDB) ReadRouterGroupByName

func (s *SqlDB) ReadRouterGroupByName(name string) (models.RouterGroup, error)

func (*SqlDB) ReadRouterGroups

func (s *SqlDB) ReadRouterGroups() (models.RouterGroups, error)

func (*SqlDB) ReadRoutes

func (s *SqlDB) ReadRoutes() ([]models.Route, error)

func (*SqlDB) ReadTcpRouteMappings

func (s *SqlDB) ReadTcpRouteMappings() ([]models.TcpRouteMapping, error)

func (*SqlDB) SaveRoute

func (s *SqlDB) SaveRoute(route models.Route) error

func (*SqlDB) SaveRouterGroup

func (s *SqlDB) SaveRouterGroup(routerGroup models.RouterGroup) error

func (*SqlDB) SaveTcpRouteMapping

func (s *SqlDB) SaveTcpRouteMapping(tcpRouteMapping models.TcpRouteMapping) error

func (*SqlDB) UnlockRouterGroupReads

func (s *SqlDB) UnlockRouterGroupReads()

func (*SqlDB) UnlockRouterGroupWrites

func (s *SqlDB) UnlockRouterGroupWrites()

func (*SqlDB) WatchChanges

func (s *SqlDB) WatchChanges(watchType string) (<-chan Event, <-chan error, context.CancelFunc)

Directories

Path Synopsis
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