sql

package
v0.1.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionConfig

type ConnectionConfig struct {
	SQLDriver  Driver
	User       string
	Password   string
	Host       string
	Port       int
	DBName     string
	TLSConfig  *tls.Config
	Parameters map[string][]string
}

func (ConnectionConfig) GetDataSourceName

func (config ConnectionConfig) GetDataSourceName() string

type DBConnection

type DBConnection interface {
	CreateUser(ctx context.Context, user, password string) error
	CreateDB(ctx context.Context, dbName string) error
	GrantPrivileges(ctx context.Context, user, dbName string) error
	UserExists(ctx context.Context, user string) (bool, error)
	DBExists(ctx context.Context, dbName string) (bool, error)
	GrantPrivilegesExists(ctx context.Context, user, dbName string) (bool, error)
	DeleteUser(ctx context.Context, user string) error
	DeleteDB(ctx context.Context, dbName string) error
	RevokePrivileges(ctx context.Context, user, dbName string) error
	GetHost() string
	GetPort() int
	Close() error
	Check() error
}

func GetDBConnection

func GetDBConnection(config ConnectionConfig) (DBConnection, error)

type Driver

type Driver int
const (
	MySQL Driver = iota
)

func (Driver) ToString

func (d Driver) ToString() string

type MySQLConnection

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

func (*MySQLConnection) Check

func (c *MySQLConnection) Check() error

func (*MySQLConnection) Close

func (c *MySQLConnection) Close() error

func (*MySQLConnection) CreateDB

func (c *MySQLConnection) CreateDB(ctx context.Context, dbName string) error

func (*MySQLConnection) CreateUser

func (c *MySQLConnection) CreateUser(ctx context.Context, user, password string) error

func (*MySQLConnection) DBExists

func (c *MySQLConnection) DBExists(ctx context.Context, dbName string) (bool, error)

func (*MySQLConnection) DeleteDB

func (c *MySQLConnection) DeleteDB(ctx context.Context, dbName string) error

func (*MySQLConnection) DeleteUser

func (c *MySQLConnection) DeleteUser(ctx context.Context, user string) error

func (*MySQLConnection) GetHost

func (c *MySQLConnection) GetHost() string

func (*MySQLConnection) GetPort

func (c *MySQLConnection) GetPort() int

func (*MySQLConnection) GrantPrivileges

func (c *MySQLConnection) GrantPrivileges(ctx context.Context, user, dbName string) error

func (*MySQLConnection) GrantPrivilegesExists

func (c *MySQLConnection) GrantPrivilegesExists(ctx context.Context, user, dbName string) (bool, error)

func (*MySQLConnection) RevokePrivileges

func (c *MySQLConnection) RevokePrivileges(ctx context.Context, user, dbName string) error

func (*MySQLConnection) UserExists

func (c *MySQLConnection) UserExists(ctx context.Context, user string) (bool, error)

Jump to

Keyboard shortcuts

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