sql

package
v0.15.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ClientInstanceKey = `SQLClient`
)

Variables

This section is empty.

Functions

func Connect

func Connect(driver string, connection interface{}) (*gorm.DB, error)

Connect sets up the database connection and creates tables.

Connection is of type interface{} - this allows for tests to pass in a sqlmock connection and for main to connect given a connection string.

func Connection

func Connection(c Config) (string, string)

Connection returns the driver and connection string to the DB.

Types

type Client

type Client interface {
	CreateKubernetesProvider(kubernetes.Provider) error
	CreateKubernetesResource(kubernetes.Resource) error
	DeleteKubernetesProvider(string) error
	GetKubernetesProvider(string) (kubernetes.Provider, error)
	GetKubernetesProviderAndPermissions(string) (kubernetes.Provider, error)
	ListKubernetesAccountsBySpinnakerApp(string) ([]string, error)
	ListKubernetesClustersByApplication(string) ([]kubernetes.Resource, error)
	ListKubernetesClustersByFields(...string) ([]kubernetes.Resource, error)
	ListKubernetesProviders() ([]kubernetes.Provider, error)
	ListKubernetesProvidersAndPermissions() ([]kubernetes.Provider, error)
	ListKubernetesResourcesByFields(...string) ([]kubernetes.Resource, error)
	ListKubernetesResourcesByTaskID(string) ([]kubernetes.Resource, error)
	ListKubernetesResourceNamesByAccountNameAndKindAndNamespace(string, string, string) ([]string, error)
	ListReadGroupsByAccountName(string) ([]string, error)
	ListWriteGroupsByAccountName(string) ([]string, error)
}

func Instance

func Instance(c *gin.Context) Client

Instance gets the singleton instance of the client.

func NewClient

func NewClient(db *gorm.DB) Client

type Config

type Config struct {
	User     string
	Password string
	Host     string
	Name     string
}

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