expression

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package literal Return a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. For example, use a $literal expression to a string that starts with a dollar sign ($) to avoid parsing as a field path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyExpression

type AnyExpression interface {
	Expression
	bsonx.IBsonValue
}

AnyExpression 整数表达式

type Array

type Array interface {
	// 默认表达式 | 数组
	defaultExpression | bsonx.BsonArray
}

Array 日期类型

type ArrayExpression

type ArrayExpression interface {
	Expression
	bsonx.IBsonValue
	Array
}

ArrayExpression 数组表达式

type Binary

type Binary interface {
	// 默认表达式 | 字节
	defaultExpression | bsonx.BsonString | bsonx.BsonBinary
}

type BinaryExpression

type BinaryExpression interface {
	Expression
	bsonx.IBsonValue
	Binary
}

BinaryExpression byte数组表达式

type Boolean

type Boolean interface {
	// 默认表达式 | 布尔
	defaultExpression | bsonx.BsonBoolean
}

Boolean 布尔类型

type BooleanExpression

type BooleanExpression interface {
	Expression
	bsonx.IBsonValue
	Boolean
}

BooleanExpression 数组表达式

type Date

type Date interface {
	// 默认表达式 | 日期 | 时间戳
	defaultExpression | bsonx.BsonDateTime | bsonx.BsonTimestamp | bsonx.BsonObjectId
}

Date 日期类型

type DateExpression

type DateExpression interface {
	Expression
	bsonx.IBsonValue
	Date
}

DateExpression 日期表达式

type DateNumberExpression

type DateNumberExpression interface {
	Expression
	bsonx.IBsonValue
	Date | Number
}

DateNumberExpression 数字或日期表达式

type Document

type Document interface {
	// 默认表达式 | 文档
	defaultExpression | bsonx.BsonDocument
}

Document 文档对象类型

type DocumentExpression

type DocumentExpression interface {
	Expression
	bsonx.IBsonValue
	Object
}

DocumentExpression 文档对象表达式

type Expression

type Expression interface {
	Exp() bsonx.IBsonValue
}

type IntExpression

type IntExpression interface {
	Expression
	bsonx.IBsonValue
	Integer
}

IntExpression 整数表达式

type IntStrExpression

type IntStrExpression interface {
	Expression
	bsonx.IBsonValue
	Integer | Stringer
}

IntStrExpression 整数或者字符串表达式

type Integer

type Integer interface {
	// 默认表达式 | 64位整数 | 32位整数
	defaultExpression | bsonx.BsonInt64 | bsonx.BsonInt32
}

Integer 整数类型

type LiteralExpression

type LiteralExpression struct {
	bsonx.BsonValue
	// contains filtered or unexported fields
}

func Literal

func Literal[T AnyExpression](expr T) LiteralExpression

Literal Returns a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. The $literal expression has the following syntax: { $literal: <value> }

func (LiteralExpression) Exp

type Number

type Number interface {
	// 默认表达式 | 64位整数 | 32位整数 | 浮点数 | decimal数
	defaultExpression | bsonx.BsonInt64 | bsonx.BsonInt32 | bsonx.BsonDouble | bsonx.BsonDecimal128
}

Number 数值类型

type NumberExpression

type NumberExpression interface {
	Expression
	bsonx.IBsonValue
	Number
}

NumberExpression 数值表达式

type ObjExpression

type ObjExpression struct {
	bsonx.BsonValue
	// contains filtered or unexported fields
}

func Obj

func Obj[T AnyExpression](fieldName string, expr T) ObjExpression

func (ObjExpression) Exp

func (o ObjExpression) Exp() bsonx.IBsonValue

type Object

type Object interface {
	// 默认表达式 | 文档| NULL | 数组对象 | undefined
	defaultExpression | bsonx.BsonDocument | bsonx.BsonNull | bsonx.BsonArray | bsonx.BsonUndefined
}

Object 对象类型

type ObjectExpression

type ObjectExpression interface {
	Expression
	bsonx.IBsonValue
	Object
}

ObjectExpression 对象表达式

type StrExpression

type StrExpression interface {
	Expression
	bsonx.IBsonValue
	Stringer
}

StrExpression 字符串表达式

type Stringer

type Stringer interface {
	// 默认表达式 | 字符串
	defaultExpression | bsonx.BsonString
}

Stringer 字符串类型

type Variable

type Variable struct {
	bsonx.BsonValue
	// contains filtered or unexported fields
}
var (
	Now         Variable = Let("NOW")          // since 4.2
	ClusterTime Variable = Let("CLUSTER_TIME") // since 4.2
	Root        Variable = Let("ROOT")
	Current     Variable = Let("CURRENT")
	Remove      Variable = Let("REMOVE")
	Descend     Variable = Let("DESCEND")
	Prune       Variable = Let("PRUNE")
	Keep        Variable = Let("KEEP")
	SearchMeta  Variable = Let("SEARCH_META")
)

func Let

func Let(varStr string) Variable

Let gen User variable

func Path

func Path(path string) Variable

Path gen path variable

func (Variable) Exp

func (v Variable) Exp() bsonx.IBsonValue

Jump to

Keyboard shortcuts

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