builder

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package builder makes SQL queries for data access object

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Scanner scanner.Scanner // scanner is a scanner object to interact with tables.
	// contains filtered or unexported fields
}

Builder builds SQL queries

func NewBuilder

func NewBuilder(dbConf params.DB, scanner scanner.Scanner) *Builder

NewBuilder constructs a new Builder object

func (*Builder) CreateQuery

func (b *Builder) CreateQuery(table tabler.Tabler, opts ...interface{}) (string, []interface{}, error)

CreateQuery constructs a INSERT SQL query.

func (*Builder) SelectQuery

func (b *Builder) SelectQuery(tableName string, condition params.Condition, fields ...string) (string, []interface{}, error)

SelectQuery constructs a SELECT SQL query.

func (*Builder) SelectQueryFields

func (b *Builder) SelectQueryFields(table tabler.Tabler, condition params.Condition, opts ...interface{}) (string, []interface{}, error)

SelectQueryFields constructs a SELECT SQL query with all fields.

func (*Builder) UpdateQuery

func (b *Builder) UpdateQuery(entity tabler.Tabler, condition params.Condition, operation string, opts ...interface{}) (string, []interface{}, error)

UpdateQuery constructs a UPDATE SQL query.

func (*Builder) UpsertQuery

func (b *Builder) UpsertQuery(entities []tabler.Tabler, opts ...interface{}) (string, []interface{}, error)

UpsertQuery constructs a INSERT SQL query with update.

type BuilderFace

type BuilderFace interface {
	CreateQuery(table tabler.Tabler, opts ...interface{}) (string, []interface{}, error)
	UpsertQuery(entities []tabler.Tabler, opts ...interface{}) (string, []interface{}, error)
	SelectQuery(tableName string, condition params.Condition, fields ...string) (string, []interface{}, error)
	SelectQueryFields(table tabler.Tabler, condition params.Condition, opts ...interface{}) (string, []interface{}, error)
	UpdateQuery(entity tabler.Tabler, condition params.Condition, operation string, opts ...interface{}) (string, []interface{}, error)
}

type Field

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

Jump to

Keyboard shortcuts

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