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 ¶
- type AnyExpression
- type Array
- type ArrayExpression
- type Binary
- type BinaryExpression
- type Boolean
- type BooleanExpression
- type Date
- type DateExpression
- type DateNumberExpression
- type Document
- type DocumentExpression
- type Expression
- type IntExpression
- type IntStrExpression
- type Integer
- type LiteralExpression
- type Number
- type NumberExpression
- type ObjExpression
- type Object
- type ObjectExpression
- type StrExpression
- type Stringer
- type Variable
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 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 ¶
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 ¶
func (l LiteralExpression) Exp() bsonx.IBsonValue
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 ¶
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 ¶
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 (Variable) Exp ¶
func (v Variable) Exp() bsonx.IBsonValue