internal

package
v0.0.0-...-79003c6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PostgresVersionKey is the query's store key used to set the postgres server version.
	PostgresVersionKey = pgversion{}
	// IncrementorKey is the scope's context key used to save current incrementor value.
	IncrementorKey = incrementorKey{}
)

Functions

func DropTables

func DropTables(ctx context.Context, conn Connection, tableName, schemaName string) error

func DummyQuotedWriteFunc

func DummyQuotedWriteFunc(sb *strings.Builder, word string)

DummyQuotedWriteFunc is the dummy writer for the quoted words.

func Incrementor

func Incrementor(s *query.Scope) int

Incrementor is the function that returns next query increment value. Used to obtain the queries values with the incremented arguments.

func RepositoryConfig

func RepositoryConfig(cfg *config.Service) (cfgDB *pgxpool.Config, err error)

RepositoryConfig gets the *ConfigDB based on the config.ModelConfig.

func ResetIncrementor

func ResetIncrementor(s *query.Scope)

ResetIncrementor resets query's incrementor.

func StringIncrementor

func StringIncrementor(s *query.Scope) string

StringIncrementor is the function that returns next query increment value in a string form. Used to obtain the queries values with the incremented arguments.

func TestingConfig

func TestingConfig(t testing.TB) *config.Service

func TestingPostgresConfig

func TestingPostgresConfig(t testing.TB) *pgxpool.Config

TestingPostgresConfig gets postgres config from the POSTGRES_TESTING environment variable.

Types

type Batch

type Batch interface {
	Len() int
	Queue(query string, arguments ...interface{})
}

Batch is the interface used for the batch queries.

type Connection

type Connection interface {
	Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, query string, values ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, query string, values ...interface{}) pgx.Row
	SendBatch(ctx context.Context, batch *pgx.Batch) pgx.BatchResults
}

Connection is the interface for the connection.

type DummyBatch

type DummyBatch struct {
	Queries []*Query
}

func (*DummyBatch) Len

func (d *DummyBatch) Len() int

func (*DummyBatch) Queue

func (d *DummyBatch) Queue(query string, arguments ...interface{})

type Query

type Query struct {
	Query     string
	Arguments []interface{}
}

Query is a single query input for the DummyBatch.

type QuotedWordWriteFunc

type QuotedWordWriteFunc func(sb *strings.Builder, word string)

QuotedWordWriteFunc is the writer for the quoted words.

Jump to

Keyboard shortcuts

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