db

package
v0.0.2 Latest Latest
Warning

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

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

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
}

func (Column) Eq

func (column Column) Eq(value interface{}) WhereCondition

func (Column) FullName

func (column Column) FullName() string

func (Column) PrimaryKey

func (column Column) PrimaryKey() bool

type InsertQuery

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

func Insert

func Insert() InsertQuery

func (InsertQuery) Execute

func (insert InsertQuery) Execute(db *sql.DB) (int64, error)

func (InsertQuery) Into

func (insert InsertQuery) Into(table Table, columns ...Column) InsertQuery

func (InsertQuery) Values

func (insert InsertQuery) Values(values ...interface{}) InsertQuery

type Query

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

func Select

func Select(columns ...Column) Query

func (Query) Execute

func (query Query) Execute(db *sql.DB) []Row

func (Query) ExecuteOne

func (query Query) ExecuteOne(db *sql.DB) (Row, error)

func (Query) From

func (query Query) From(table Table) Query

func (Query) Join

func (query Query) Join(table Table, leftColumn, rightColumn Column) Query

func (Query) Limit

func (query Query) Limit(limit int) Query

func (Query) Where

func (query Query) Where(condition WhereCondition) Query

type Row

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

func (Row) GetInt64

func (row Row) GetInt64(column Column) int64

func (Row) GetString

func (row Row) GetString(column Column) string

func (Row) GetValue

func (row Row) GetValue(column Column) interface{}

These are designed to be used in the views, so they dont panic, or return errors

func (Row) String

func (row Row) String(column Column) string

type Table

type Table string

func (Table) Column

func (table Table) Column(name string) Column

func (Table) Columns

func (table Table) Columns() []Column

func (Table) PrimaryKey

func (table Table) PrimaryKey() Column

type UpdateQuery

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

func Update

func Update(table Table) UpdateQuery

func (UpdateQuery) Execute

func (query UpdateQuery) Execute(db *sql.DB) error

func (UpdateQuery) Set

func (query UpdateQuery) Set(column Column, value interface{}) UpdateQuery

func (UpdateQuery) Where

func (query UpdateQuery) Where(condition WhereCondition) UpdateQuery

type WhereCondition

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

Jump to

Keyboard shortcuts

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