sql

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: AGPL-3.0 Imports: 15 Imported by: 192

Documentation

Overview

Package sql provides tools and DAOs for speaking SQL as well as managing tables migrations

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRows = sql.ErrNoRows
)

Functions

func GetQueryValueFor

func GetQueryValueFor(field string, values ...string) string

GetQueryValueFor field value

func JoinWheresWithParenthesis

func JoinWheresWithParenthesis(wheres []string, join string) string

JoinConditionsWithParenthesis joins conditions using parenthesis if there are many, or no parenthesis if there is just one, and prepend the WHERE keyword to the string

func NewDAOQuery

func NewDAOQuery(enquirer Enquirer, converters ...common.Converter) fmt.Stringer

NewDAOQuery adds database functionality to a Query proto message

Types

type BatchReceiver

type BatchReceiver interface {
	Recv(interface{})
}

BatchReceiver interface

type BatchSender

type BatchSender interface {
	Send(interface{})
	Close() error
}

BatchSender interface

type DAO

type DAO interface {
	dao.DAO

	DB() *sql.DB
	Prepare(string, interface{}) error
	GetStmt(string, ...interface{}) *sql.Stmt
	UseExclusion()
	Lock()
	Unlock()
}

DAO interface definition

func NewDAO

func NewDAO(driver string, dsn string, prefix string) DAO

type Enquirer

type Enquirer interface {
	GetSubQueries() []*any.Any
	GetOperation() service.OperationType
	GetOffset() int64
	GetLimit() int64
	GetGroupBy() int32
	GetResourcePolicyQuery() *service.ResourcePolicyQuery

	fmt.Stringer
}

Enquirer interface

type Handler

type Handler struct {
	dao.DAO
	// contains filtered or unexported fields
}

Handler for the main functions of the DAO

func (*Handler) DB

func (h *Handler) DB() *sql.DB

DB returns the sql DB object

func (*Handler) GetStmt

func (h *Handler) GetStmt(key string, args ...interface{}) *sql.Stmt

GetStmts returns a list of all statements used by the dao

func (*Handler) Init

func (h *Handler) Init(c config.Map) error

func (*Handler) Lock

func (h *Handler) Lock()

func (*Handler) Prepare

func (h *Handler) Prepare(key string, query interface{}) error

Prepare the statements that can be used by the DAO

func (*Handler) Unlock

func (h *Handler) Unlock()

func (*Handler) UseExclusion

func (h *Handler) UseExclusion()

type PackrBox

type PackrBox interface {
	List() []string
	Bytes(name string) []byte
}

Avoids pulling in the packr library for everyone, mimicks the bits of packr.Box that we need.

type PackrMigrationSource

type PackrMigrationSource struct {
	Box PackrBox

	// Path in the box to use.
	Dir string

	TablePrefix string
}

Migrations from a packr box.

func (PackrMigrationSource) FindMigrations

func (p PackrMigrationSource) FindMigrations() ([]*migrate.Migration, error)

type Scanner

type Scanner interface {
	Scan(...interface{}) error
}

Directories

Path Synopsis
Package index provides ready-to-use tables and DAOs for storing hierarchical data using the nested sets pattern * Copyright (c) 2018.
Package index provides ready-to-use tables and DAOs for storing hierarchical data using the nested sets pattern * Copyright (c) 2018.
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data

Jump to

Keyboard shortcuts

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