statement

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpaceSeparator = " "
	CommaSeparator = ", "
)

Variables

This section is empty.

Functions

func WriteDelete

func WriteDelete(sw io.StringWriter, table string) error

func WriteInsert

func WriteInsert(sw io.StringWriter, into string, columns []string) error

WriteInsert writes a SQL WriteInsert statement to the given string writer.

Example:

INSERT INTO users (username, age)

func WriteSelect

func WriteSelect(sw io.StringWriter, selectColumns []clauses.Selectable) error

WriteSelect writes a SQL select query to the given string writer.

Example:

SELECT field1, field2, field3

func WriteUpdate

func WriteUpdate(sw io.StringWriter, table string) error

WriteUpdate writes a SQL update query to the given string writer.

Example:

UPDATE table

Types

type ClauseWriter

type ClauseWriter struct {
	ClauseSeparator string
	// contains filtered or unexported fields
}

ClauseWriter represents a ClauseWriter.

func (*ClauseWriter) SetClause

func (s *ClauseWriter) SetClause(c clauses.Clause)

SetClause implements Statement SetClause.

func (*ClauseWriter) Write added in v0.0.3

func (s *ClauseWriter) Write(sw io.StringWriter) error

Write writes clauses to the string writer.

type Delete

type Delete struct {
	ClauseWriter
	// contains filtered or unexported fields
}

Delete writes a SQL From string to the given string writer.

func NewDelete

func NewDelete(
	table string,
) *Delete

NewDelete creates a new Delete statement.

func (*Delete) Write added in v0.0.3

func (d *Delete) Write(sw io.StringWriter) error

ToSQL returns the query as a string and it's arguments and an error if any.

type Insert

type Insert struct {
	ClauseWriter
	// contains filtered or unexported fields
}

SelectWriter writes a SQL From string to the given string writer.

func NewInsert

func NewInsert(table string, columns []string) *Insert

NewSelectClause creates a new SelectClause.

func (*Insert) Write added in v0.0.3

func (i *Insert) Write(sw io.StringWriter) error

ToSQL returns the query as a string and it's arguments and an error if any.

type Select

type Select struct {
	ClauseWriter
	// contains filtered or unexported fields
}

SelectWriter writes a SQL From string to the given string writer.

func NewSelect

func NewSelect(
	selectColumns []clauses.Selectable,
) *Select

NewSelectClause creates a new SelectClause.

func (*Select) Write added in v0.0.3

func (s *Select) Write(sw io.StringWriter) error

ToSQL returns the query as a string and it's arguments and an error if any.

type Statement

type Statement interface {
	expressions.Expression
	SetClause(clauses.Clause)
}

type Update

type Update struct {
	ClauseWriter
	// contains filtered or unexported fields
}

Update writes an update statement to the given string writer.

func NewUpdate

func NewUpdate(
	table string,
) *Update

NewUpdate creates a new update statement.

func (*Update) Write added in v0.0.3

func (u *Update) Write(sw io.StringWriter) error

ToSQL returns the query as a string and it's arguments and an error if any.

Jump to

Keyboard shortcuts

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