querybuilder

package module
v0.0.0-...-af9eeb7 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INVALID_FILE_TYPE = "invalid file type"
)

Variables

This section is empty.

Functions

func QueryBuilderInitialize

func QueryBuilderInitialize(scriptPath string) error

Types

type BindEntry

type BindEntry map[string]Entry

type DataError

type DataError struct {
	Message string
}

func (DataError) Error

func (e DataError) Error() string

type DatabaseError

type DatabaseError struct {
	Message string
}

func (DatabaseError) Error

func (e DatabaseError) Error() string

type Entry

type Entry struct {
	Description string   `yaml:"description"`
	Type        string   `yaml:"type"`
	Columns     []string `yaml:"columns"`
	Script      string   `yaml:"script"`
}

type Mariadb

type Mariadb struct {
	Config MariadbConfig
	DB     *sqlx.DB
}

Mariadb

func (*Mariadb) Connect

func (conn *Mariadb) Connect() error

func (*Mariadb) Disconnect

func (conn *Mariadb) Disconnect() error

func (*Mariadb) Exec

func (conn *Mariadb) Exec(statement *Statement) error

func (*Mariadb) ExecBulk

func (conn *Mariadb) ExecBulk(statement *Statement) error

func (*Mariadb) Query

func (conn *Mariadb) Query(statement *Statement) ([]map[string]interface{}, error)

func (*Mariadb) QueryRow

func (conn *Mariadb) QueryRow(statement *Statement) (map[string]interface{}, error)

func (*Mariadb) QueryRowWithParam

func (conn *Mariadb) QueryRowWithParam(statement *Statement) (map[string]interface{}, error)

func (*Mariadb) QueryWithParam

func (conn *Mariadb) QueryWithParam(statement *Statement) ([]map[string]interface{}, error)

func (*Mariadb) Select

func (conn *Mariadb) Select(statement *Statement) ([]map[string]interface{}, error)

type MariadbConfig

type MariadbConfig struct {
	ConnectionString string `toml:"MYSQL_CONNECTION_STRING"`
	MaxIdleConns     int    // default 10
	MaxOpenConns     int    // default 10
}

type QueryBuilder

type QueryBuilder struct {
	ScriptPath string
	Query      BindEntry
}

func GetQueryBuilder

func GetQueryBuilder() *QueryBuilder

func (*QueryBuilder) GetStatement

func (qb *QueryBuilder) GetStatement(name string) *Statement

func (*QueryBuilder) Load

func (qb *QueryBuilder) Load() error

type QueryError

type QueryError struct {
	QueryFile string
	Message   string
}

func (*QueryError) Error

func (e *QueryError) Error() string

type QueryExecute

type QueryExecute interface {
	Connect()
	Query()
}

type Statement

type Statement struct {
	Name        string
	Type        string
	Description string
	Script      string
	Columns     []string
	Parameter   map[string]interface{}
	Parameters  []map[string]interface{}
}

Jump to

Keyboard shortcuts

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