github.com/XiaoMi/Gaea@v1.2.5/core/errors/errors.go (about) 1 // Copyright 2016 The kingshard Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"): you may 4 // not use this file except in compliance with the License. You may obtain 5 // 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, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations 13 // under the License. 14 15 package errors 16 17 import ( 18 "errors" 19 ) 20 21 var ( 22 // ErrNoMasterConn no master connection 23 ErrNoMasterConn = errors.New("no master connection") 24 // ErrNoSlaveConn no slave connection 25 ErrNoSlaveConn = errors.New("no slave connection") 26 // ErrNoDefaultSlice no default slice 27 ErrNoDefaultSlice = errors.New("no default slice") 28 // ErrNoMasterDB no master database 29 ErrNoMasterDB = errors.New("no master database") 30 // ErrNoSlaveDB no slve database 31 ErrNoSlaveDB = errors.New("no slave database") 32 // ErrNoDatabase no database 33 ErrNoDatabase = errors.New("no database") 34 35 // ErrMasterDown master is down 36 ErrMasterDown = errors.New("master is down") 37 // ErrSlaveDown slave is down 38 ErrSlaveDown = errors.New("slave is down") 39 40 // ErrInvalidArgument invalid arguments 41 ErrInvalidArgument = errors.New("argument is invalid") 42 // ErrInvalidCharset invalid charset 43 ErrInvalidCharset = errors.New("charset is invalid") 44 // ErrCmdUnsupport unsupport command 45 ErrCmdUnsupport = errors.New("command unsupport") 46 47 // ErrLocationsCount locations count is wrong 48 ErrLocationsCount = errors.New("locations count is not equal") 49 // ErrInvalidMycatLocations mycat locations is wrong 50 ErrInvalidMycatLocations = errors.New("mycat locations must be all 1") 51 // ErrNoCriteria no shard condition 52 ErrNoCriteria = errors.New("plan have no criteria") 53 // ErrSelectInInsert insert sql has sub select sql, not support 54 ErrSelectInInsert = errors.New("select in insert not allowed") 55 // ErrInsertInMulti insert into multi slice 56 ErrInsertInMulti = errors.New("insert in multi slice") 57 // ErrUpdateInMulti update multi slice 58 ErrUpdateInMulti = errors.New("update in multi slice") 59 // ErrDeleteInMulti delete multi slice 60 ErrDeleteInMulti = errors.New("delete in multi slice") 61 // ErrReplaceInMulti replace multi slice 62 ErrReplaceInMulti = errors.New("replace in multi slice") 63 // ErrExecInMulti execute in multi slice 64 ErrExecInMulti = errors.New("exec in multi slice") 65 // ErrTransInMulti transaction cross slices, not support 66 ErrTransInMulti = errors.New("transaction in multi slice") 67 // ErrUnsupportedShard unsupport shard type 68 ErrUnsupportedShard = errors.New("sql is unsupported in shard mode") 69 70 // ErrNoPlan get no plan 71 ErrNoPlan = errors.New("statement have no plan") 72 // ErrUpdateKey update shard key 73 ErrUpdateKey = errors.New("routing key in update expression") 74 // ErrConnNotEqual count of sqls doesn't match lenth of conns 75 ErrConnNotEqual = errors.New("the length of conns not equal sqls") 76 // ErrKeyOutOfRange shard key out of range 77 ErrKeyOutOfRange = errors.New("shard key not in key range") 78 // ErrIRNoColumns insert or replace doesn't specify columns 79 ErrIRNoColumns = errors.New("insert or replace must specify columns") 80 // ErrIRNoShardingKey insert or replace not contain sharding key 81 ErrIRNoShardingKey = errors.New("insert or replace not contain sharding key") 82 // ErrDateRangeIllegal date range invalided 83 ErrDateRangeIllegal = errors.New("date range format illegal") 84 // ErrDateRangeCount date range count invalided 85 ErrDateRangeCount = errors.New("date range count is not equal") 86 // ErrDateRangeOverlap date range overlap 87 ErrDateRangeOverlap = errors.New("date range is overlapped") 88 // ErrUnknownRuleType unknown rule type 89 ErrUnknownRuleType = errors.New("unknown rule type") 90 // ErrInvalidSQLMode invalid sql mode 91 ErrInvalidSQLMode = errors.New("invalid sql mode") 92 // ErrInternalServer internal error 93 ErrInternalServer = errors.New("internal server error") 94 // ErrUserIsReadOnly user is readonly 95 ErrUserIsReadOnly = errors.New("user is readonly") 96 97 // ErrNamespaceNotPrepared commit namespace config without prepare 98 ErrNamespaceNotPrepared = errors.New("namespace is not prepared") 99 100 ErrTimeLimitExceeded = errors.New("sql execute time exceeded") 101 ErrRowsLimitExceeded = errors.New("sql result set size exceeded") 102 )