github.com/XiaoMi/Gaea@v1.2.5/parser/types/eval_type.go (about) 1 // Copyright 2017 PingCAP, 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 types 15 16 // EvalType indicates the specified types that arguments and result of a built-in function should be. 17 type EvalType byte 18 19 const ( 20 // ETInt represents type INT in evaluation. 21 ETInt EvalType = iota 22 // ETReal represents type REAL in evaluation. 23 ETReal 24 // ETDecimal represents type DECIMAL in evaluation. 25 ETDecimal 26 // ETString represents type STRING in evaluation. 27 ETString 28 // ETDatetime represents type DATETIME in evaluation. 29 ETDatetime 30 // ETTimestamp represents type TIMESTAMP in evaluation. 31 ETTimestamp 32 // ETDuration represents type DURATION in evaluation. 33 ETDuration 34 // ETJson represents type JSON in evaluation. 35 ETJson 36 ) 37 38 // IsStringKind returns true for ETString, ETDatetime, ETTimestamp, ETDuration, ETJson EvalTypes. 39 func (et EvalType) IsStringKind() bool { 40 return et == ETString || et == ETDatetime || 41 et == ETTimestamp || et == ETDuration || et == ETJson 42 }