github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/dbs/memristed/memex/generator/helper/helper.go (about) 1 // Copyright 2020 WHTCORPS INC, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package helper 15 16 // TypeContext is the template context for each "github.com/whtcorpsinc/milevadb/types".EvalType . 17 type TypeContext struct { 18 // Describe the name of "github.com/whtcorpsinc/milevadb/types".ET{{ .ETName }} . 19 ETName string 20 // Describe the name of "github.com/whtcorpsinc/milevadb/memex".VecExpr.VecEval{{ .TypeName }} . 21 TypeName string 22 // Describe the name of "github.com/whtcorpsinc/milevadb/soliton/chunk".*DeferredCauset.Append{{ .TypeNameInDeferredCauset }}, 23 // Resize{{ .TypeNameInDeferredCauset }}, Reserve{{ .TypeNameInDeferredCauset }}, Get{{ .TypeNameInDeferredCauset }} and 24 // {{ .TypeNameInDeferredCauset }}s. 25 // If undefined, it's same as TypeName. 26 TypeNameInDeferredCauset string 27 // Describe the type name in golang. 28 TypeNameGo string 29 // Same as "github.com/whtcorpsinc/milevadb/soliton/chunk".getFixedLen() . 30 Fixed bool 31 } 32 33 var ( 34 // TypeInt represents the template context of types.ETInt . 35 TypeInt = TypeContext{ETName: "Int", TypeName: "Int", TypeNameInDeferredCauset: "Int64", TypeNameGo: "int64", Fixed: true} 36 // TypeReal represents the template context of types.ETReal . 37 TypeReal = TypeContext{ETName: "Real", TypeName: "Real", TypeNameInDeferredCauset: "Float64", TypeNameGo: "float64", Fixed: true} 38 // TypeDecimal represents the template context of types.ETDecimal . 39 TypeDecimal = TypeContext{ETName: "Decimal", TypeName: "Decimal", TypeNameInDeferredCauset: "Decimal", TypeNameGo: "types.MyDecimal", Fixed: true} 40 // TypeString represents the template context of types.ETString . 41 TypeString = TypeContext{ETName: "String", TypeName: "String", TypeNameInDeferredCauset: "String", TypeNameGo: "string", Fixed: false} 42 // TypeDatetime represents the template context of types.ETDatetime . 43 TypeDatetime = TypeContext{ETName: "Datetime", TypeName: "Time", TypeNameInDeferredCauset: "Time", TypeNameGo: "types.Time", Fixed: true} 44 // TypeDuration represents the template context of types.ETDuration . 45 TypeDuration = TypeContext{ETName: "Duration", TypeName: "Duration", TypeNameInDeferredCauset: "GoDuration", TypeNameGo: "time.Duration", Fixed: true} 46 // TypeJSON represents the template context of types.ETJson . 47 TypeJSON = TypeContext{ETName: "Json", TypeName: "JSON", TypeNameInDeferredCauset: "JSON", TypeNameGo: "json.BinaryJSON", Fixed: false} 48 )