qbx

package module
v0.0.0-...-9e61392 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

qbx

Go query builder for pgx. Still under active development.

Why created

No database agnostic, just purely tuned for PostgreSQL query building + loading data to struct.

Usage

b := &qbx.SelectStmt{}
sql, err := b.Select("id", "name", "email").From("account").Limit(10).ToSQL()
if err != nil {
	t.Fatal(err)
}
log.Println(sql) // SELECT id, name, email FROM account LIMIT 10	

Inspired by

Huge thanks to both of the libraries.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SelectStmt

type SelectStmt struct {
	Comment    string
	IsDistinct bool

	Columns []string
	Set     interface{}

	LimitCount  int64
	OffsetCount int64
}

SelectStmt builds select statement

func (*SelectStmt) Distinct

func (b *SelectStmt) Distinct() *SelectStmt

Distinct creates distinct part of SQL

func (*SelectStmt) From

func (b *SelectStmt) From(set interface{}) *SelectStmt

From creates from part of SQL

func (*SelectStmt) Limit

func (b *SelectStmt) Limit(n uint64) *SelectStmt

Limit create limit part of SQL

func (*SelectStmt) Select

func (b *SelectStmt) Select(columns ...string) *SelectStmt

Select creates select part of SQL

func (*SelectStmt) ToSQL

func (b *SelectStmt) ToSQL() (string, error)

ToSQL creates sql statement

Jump to

Keyboard shortcuts

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