sqlgen

package module
v0.0.0-...-dedadca Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: BSD-2-Clause Imports: 5 Imported by: 0

README

sqlgen

sql generator

sqlgen will not check sql syntax.

q := sqlgen.Select("a","n")
q.From("test")
q.Where("a = ?", 1) // ok
q.Where("a = ?") // ok, but it may fail

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostgresSQLFormat

func PostgresSQLFormat(query string) string

Types

type DatabaseQuery

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

func Delete

func Delete() *DatabaseQuery

Delete delete

func Insert

func Insert(table string) *DatabaseQuery

Insert insert

func Select

func Select(columns ...string) *DatabaseQuery

Select select ....

func Update

func Update(table string) *DatabaseQuery

Update update

func (*DatabaseQuery) Columns

func (q *DatabaseQuery) Columns(columns ...string)

Columns add columns

func (*DatabaseQuery) Distinct

func (q *DatabaseQuery) Distinct()

Distinct "select distinct"

func (*DatabaseQuery) From

func (q *DatabaseQuery) From(tables ...string) error

From "... from ..."

func (*DatabaseQuery) GroupBys

func (q *DatabaseQuery) GroupBys(groupbys ...string)

GroupBys add "group by ..."

func (*DatabaseQuery) Having

func (q *DatabaseQuery) Having(query string, args ...interface{})

Having add "having ..."

func (*DatabaseQuery) Limit

func (q *DatabaseQuery) Limit(limit uint64)

Limit add "limit ..."

func (*DatabaseQuery) Offset

func (q *DatabaseQuery) Offset(offset uint64)

Offset add "offset ..."

func (*DatabaseQuery) OrderBys

func (q *DatabaseQuery) OrderBys(orderbys ...string)

OrderBys add "ORDER BY"

func (*DatabaseQuery) Set

func (q *DatabaseQuery) Set(query string, args ...interface{})

Set update ... "set ..."

func (*DatabaseQuery) Tables

func (q *DatabaseQuery) Tables(tables ...string) error

Tables add tables

func (*DatabaseQuery) ToSQL

func (q *DatabaseQuery) ToSQL() (string, []interface{}, error)

ToSQL generate sql string

func (*DatabaseQuery) Values

func (q *DatabaseQuery) Values(args []interface{}) error

Values insert into ... "values ..."

func (*DatabaseQuery) Where

func (q *DatabaseQuery) Where(query string, args ...interface{})

Where "where ..."

Jump to

Keyboard shortcuts

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