querybuilder

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryBuilder

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

QueryBuilder builds an insert query based on the number of arguments, how many values to insert, and an initial query defined as `insert into table_name(arg1, ..., argn) values %s;`. QueryBuilder maintains a map of queries that have already been built in memory to improve performance.

func New

func New(query string, numArgs int) QueryBuilder

New creates a QueryBuilder and initializes it with the initial query, the number of arguments, and a 0-size queries map.

func (QueryBuilder) Build

func (q QueryBuilder) Build(size int) string

Build builds a query based on the number of values to insert.

func (QueryBuilder) Init

func (q QueryBuilder) Init(n int)

Init initializes the queries map with n default queries.

Jump to

Keyboard shortcuts

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