qf

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(f qb.Field) qb.Field

Abs returns the absolute value, turning all negatieve numbers into positive numbers

func Add

func Add(f1 qb.Field, i interface{}) qb.Field

Add adds the values (+)

func Average

func Average(f qb.Field) qb.Field

Average calculates the average of all values in this field

func Cast

func Cast(f qb.Field, t qb.DataType) qb.Field

Cast casts a value to a different type

func Ceil

func Ceil(f qb.Field) qb.Field

Ceil rounds a value up

func Coalesce

func Coalesce(f1 qb.Field, i interface{}) qb.Field

Coalesce returns the second argument if the first one is NULL

func Concat

func Concat(i ...interface{}) qb.Field

Concat combines fields and strings into a single string

func Count

func Count(f qb.Field) qb.Field

Count counts the number of non-NULL values for this field

func CountAll

func CountAll() qb.Field

CountAll counts the number of rows

func Day

func Day(f qb.Field) qb.Field

Day retrieves the day from a date

func Distinct

func Distinct(f qb.Field) qb.Field

Distinct removes all duplicate values for this field

func Div

func Div(f1 qb.Field, i interface{}) qb.Field

Div divides the values (/)

func Excluded

func Excluded(f qb.Field) qb.Field

Excluded uses a value from the INSERT, only usable in an upsert query

func Extract

func Extract(f qb.Field, part string) qb.Field

Extract retrieves a the given part of a date

func Floor

func Floor(f qb.Field) qb.Field

Floor rounds a value down

func Hour

func Hour(f qb.Field) qb.Field

Hour retrieves the hour from a date

func Lower

func Lower(f qb.Field) qb.Field

Lower returns the value as a lowercase string

func Max

func Max(f qb.Field) qb.Field

Max calculates the maximum value in this field

func Min

func Min(f qb.Field) qb.Field

Min calculates the minimum value in this field

func Minute

func Minute(f qb.Field) qb.Field

Minute retrieves the minute from a date

func Mod

func Mod(f1 qb.Field, i interface{}) qb.Field

Mod gets the remainder of the division (%)

func Month

func Month(f qb.Field) qb.Field

Month retrieves the month from a date

func Mult

func Mult(f1 qb.Field, i interface{}) qb.Field

Mult multiplies the values (*)

func Now

func Now() qb.Field

Now retrieves the current time

func Pow

func Pow(f1 qb.Field, i interface{}) qb.Field

Pow calculates the power of a number (^)

func Replace

func Replace(f qb.Field, from, to interface{}) qb.Field

Replace replaces values in a string

func Round

func Round(f1 qb.Field, precision int) qb.Field

Round rounds a value to the specified precision

func Second

func Second(f qb.Field) qb.Field

Second retrieves the second from a date

func Sub

func Sub(f1 qb.Field, i interface{}) qb.Field

Sub subtracts the values (-)

func Substring

func Substring(f qb.Field, from, length interface{}) qb.Field

Substring retrieves a part of a string

func Sum

func Sum(f qb.Field) qb.Field

Sum calculates the sum of all values in this field

func Week

func Week(f qb.Field) qb.Field

Week retrieves the week from a date

func Year

func Year(f qb.Field) qb.Field

Year retrieves the year from a date

Types

type CalculatedField

type CalculatedField func(c *qb.Context) string

CalculatedField is a field created by running functions on a TableField

func NewCalculatedField

func NewCalculatedField(args ...interface{}) CalculatedField

NewCalculatedField returns a new CalculatedField

func (CalculatedField) QueryString

func (f CalculatedField) QueryString(c *qb.Context) string

QueryString implements qb.Field

type CaseField

type CaseField struct {
	When []when
	Else qb.Field
}

CaseField is a qb.Field that generates a case statement

func (CaseField) QueryString

func (f CaseField) QueryString(c *qb.Context) string

QueryString returns a string for use in queries

type WhenList

type WhenList []when

WhenList contains a list of CASE when statements

func Case

func Case() WhenList

Case returns a type that allows you to build a when statement

func (WhenList) Else

func (l WhenList) Else(v interface{}) CaseField

Else returns a valid Field to finish the case

func (WhenList) When

func (l WhenList) When(c qb.Condition, v interface{}) WhenList

When adds a statement to the list

Jump to

Keyboard shortcuts

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