gobuilder

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timeout time.Duration = 30

Default time for query statute of limitations, you can change this value for each query as you need.

Functions

This section is empty.

Types

type GoBuilder

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

https://github.com/mstgnz/gobuilder

func NewGoBuilder

func NewGoBuilder(holderClause SQLDialect) *GoBuilder

NewGoBuilder initializes a new instance of GoBuilder

func (*GoBuilder) Between

func (gb *GoBuilder) Between(column string, args ...any) *GoBuilder

Between adds a BETWEEN clause with bind parameters

func (*GoBuilder) Create

func (gb *GoBuilder) Create(args map[string]any, returning ...string) *GoBuilder

Create adds an INSERT INTO statement to the query with bind parameters

func (*GoBuilder) Delete

func (gb *GoBuilder) Delete() *GoBuilder

Delete builds a DELETE statement

func (*GoBuilder) GroupBy

func (gb *GoBuilder) GroupBy(columns ...string) *GoBuilder

GroupBy adds a GROUP BY clause

func (*GoBuilder) Having

func (gb *GoBuilder) Having(condition string, args ...any) *GoBuilder

Having adds a HAVING clause

func (*GoBuilder) In

func (gb *GoBuilder) In(column string, args ...any) *GoBuilder

In adds an IN clause with bind parameters

func (*GoBuilder) IsNotNull

func (gb *GoBuilder) IsNotNull(column string) *GoBuilder

IsNotNull adds an IS NOT NULL clause

func (*GoBuilder) IsNull

func (gb *GoBuilder) IsNull(column string) *GoBuilder

IsNull adds an IS NULL clause

func (*GoBuilder) Join

func (gb *GoBuilder) Join(table, first, operator, last string) *GoBuilder

Join adds a JOIN clause

func (*GoBuilder) LeftJoin

func (gb *GoBuilder) LeftJoin(table, first, operator, last string) *GoBuilder

LeftJoin adds a LEFT JOIN clause

func (*GoBuilder) Limit

func (gb *GoBuilder) Limit(offset, limit int) *GoBuilder

Limit adds a LIMIT clause

func (*GoBuilder) OrBetween

func (gb *GoBuilder) OrBetween(column string, args ...any) *GoBuilder

OrBetween adds an OR BETWEEN clause with bind parameters

func (*GoBuilder) OrIn

func (gb *GoBuilder) OrIn(column string, args ...any) *GoBuilder

OrIn adds an OR IN clause with bind parameters

func (*GoBuilder) OrIsNotNull

func (gb *GoBuilder) OrIsNotNull(column string) *GoBuilder

OrIsNotNull adds an OR IS NOT NULL clause

func (*GoBuilder) OrIsNull

func (gb *GoBuilder) OrIsNull(column string) *GoBuilder

OrIsNull adds an OR IS NULL clause

func (*GoBuilder) OrWhere

func (gb *GoBuilder) OrWhere(key, opt string, val any) *GoBuilder

OrWhere adds an OR WHERE clause with bind parameters

func (*GoBuilder) OrderBy

func (gb *GoBuilder) OrderBy(columns ...string) *GoBuilder

OrderBy adds an ORDER BY ASC clause

func (*GoBuilder) OrderByDesc

func (gb *GoBuilder) OrderByDesc(columns ...string) *GoBuilder

OrderByDesc adds an ORDER BY DESC clause

func (*GoBuilder) Prepare

func (gb *GoBuilder) Prepare() (string, []any)

Prepare returns the final SQL query and the associated bind parameters

func (*GoBuilder) RightJoin

func (gb *GoBuilder) RightJoin(table, first, operator, last string) *GoBuilder

RightJoin adds a RIGHT JOIN clause

func (*GoBuilder) Select

func (gb *GoBuilder) Select(columns ...string) *GoBuilder

Select defines the columns to be selected in the query

func (*GoBuilder) SelectDistinct

func (gb *GoBuilder) SelectDistinct(columns ...string) *GoBuilder

SelectDistinct defines the distinct columns to be selected

func (*GoBuilder) Sql

func (gb *GoBuilder) Sql() string

Sql returns the final SQL query

func (*GoBuilder) Table

func (gb *GoBuilder) Table(table string) *GoBuilder

Table specifies the table name for the query

func (*GoBuilder) Union

func (gb *GoBuilder) Union(sql string) *GoBuilder

Union adds a UNION clause

func (*GoBuilder) Update

func (gb *GoBuilder) Update(args map[string]any) *GoBuilder

Update builds an UPDATE statement with bind parameters

func (*GoBuilder) Where

func (gb *GoBuilder) Where(key, opt string, val any) *GoBuilder

Where adds a WHERE clause with bind parameters

type SQLDialect

type SQLDialect string
const (
	Postgres  SQLDialect = "postgres"
	MySQL     SQLDialect = "mysql"
	SQLite    SQLDialect = "sqlite"
	SQLServer SQLDialect = "sqlserver"
	Oracle    SQLDialect = "oracle"
)

Jump to

Keyboard shortcuts

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