sql

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

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

Go to latest
Published: Dec 6, 2019 License: MIT Imports: 5 Imported by: 0

README

gosql

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Table *Table
	Name  string
	Alias string
	Type  Type
}

Column of database

func NewColumn

func NewColumn(table *Table, name string, alias string, columnType Type) *Column

func NewFunctionColumn

func NewFunctionColumn(function string, alias string, args ...string) *Column

func (*Column) As

func (col *Column) As(alias string) *Column

func (*Column) String

func (col *Column) String() string

String return the Column as string

type SQL

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

SQL

func NewSQL

func NewSQL() *SQL

func (*SQL) From

func (sql *SQL) From(tables ...*Table) *SQL

func (*SQL) Query

func (sql *SQL) Query() string

Query return the string of the sql query (for send to server, will add semicolon)

func (*SQL) Select

func (sql *SQL) Select(columns ...*Column) *SQL

func (*SQL) ToString

func (sql *SQL) ToString() string

ToString return the string of this sql query (for sub-query, will add brackets)

func (*SQL) Where

func (sql *SQL) Where(conditions ...*op.Operator) *SQL

type Table

type Table struct {
	Database string
	Name     string
	Alias    string
}

func NewTable

func NewTable(database string, name string, alias string) *Table

func (*Table) As

func (tb *Table) As(alias string) *Table

func (*Table) Prefix

func (tb *Table) Prefix() string

func (*Table) SQL

func (tb *Table) SQL() *SQL

func (*Table) String

func (tb *Table) String() string

String return from part of table

type Type

type Type uint8

Type of database value

const (
	ColumnTypeFunction Type = iota
	ColumnTypeUnknown
)

Database value type list

func (Type) String

func (t Type) String() string

String name of database value type

Directories

Path Synopsis
TestFlag project main.go
TestFlag project main.go
utils

Jump to

Keyboard shortcuts

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