mysql

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultSlowLogTimeout    = 500 * time.Millisecond //毫秒
	DefaultMaxOpenConns      = 800
	DefaultConnectWaiTimeout = 15 * time.Second
	DefaultCharset           = "utf8"
)
View Source
const (
	ErrErrorFirst                                            uint16 = 1000
	ErrHashchk                                                      = 1000
	ErrNisamchk                                                     = 1001
	ErrNo                                                           = 1002
	ErrYes                                                          = 1003
	ErrCantCreateFile                                               = 1004
	ErrCantCreateTable                                              = 1005
	ErrCantCreateDb                                                 = 1006
	ErrDbCreateExists                                               = 1007
	ErrDbDropExists                                                 = 1008
	ErrDbDropDelete                                                 = 1009
	ErrDbDropRmdir                                                  = 1010
	ErrCantDeleteFile                                               = 1011
	ErrCantFindSystemRec                                            = 1012
	ErrCantGetStat                                                  = 1013
	ErrCantGetWd                                                    = 1014
	ErrCantLock                                                     = 1015
	ErrCantOpenFile                                                 = 1016
	ErrFileNotFound                                                 = 1017
	ErrCantReadDir                                                  = 1018
	ErrCantSetWd                                                    = 1019
	ErrCheckread                                                    = 1020
	ErrDiskFull                                                     = 1021
	ErrDupKey                                                       = 1022
	ErrErrorOnClose                                                 = 1023
	ErrErrorOnRead                                                  = 1024
	ErrErrorOnRename                                                = 1025
	ErrErrorOnWrite                                                 = 1026
	ErrFileUsed                                                     = 1027
	ErrFilsortAbort                                                 = 1028
	ErrFormNotFound                                                 = 1029
	ErrGetErrno                                                     = 1030
	ErrIllegalHa                                                    = 1031
	ErrKeyNotFound                                                  = 1032
	ErrNotFormFile                                                  = 1033
	ErrNotKeyfile                                                   = 1034
	ErrOldKeyfile                                                   = 1035
	ErrOpenAsReadonly                                               = 1036
	ErrOutofmemory                                                  = 1037
	ErrOutOfSortmemory                                              = 1038
	ErrUnexpectedEof                                                = 1039
	ErrConCountError                                                = 1040
	ErrOutOfResources                                               = 1041
	ErrBadHostError                                                 = 1042
	ErrHandshakeError                                               = 1043
	ErrDbaccessDeniedError                                          = 1044
	ErrAccessDeniedError                                            = 1045
	ErrNoDbError                                                    = 1046
	ErrUnknownComError                                              = 1047
	ErrBadNullError                                                 = 1048
	ErrBadDbError                                                   = 1049
	ErrTableExistsError                                             = 1050
	ErrBadTableError                                                = 1051
	ErrNonUniqError                                                 = 1052
	ErrServerShutdown                                               = 1053
	ErrBadFieldError                                                = 1054
	ErrWrongFieldWithGroup                                          = 1055
	ErrWrongGroupField                                              = 1056
	ErrWrongSumSelect                                               = 1057
	ErrWrongValueCount                                              = 1058
	ErrTooLongIdent                                                 = 1059
	ErrDupFieldname                                                 = 1060
	ErrDupKeyname                                                   = 1061
	ErrDupEntry                                                     = 1062
	ErrWrongFieldSpec                                               = 1063
	ErrParseError                                                   = 1064
	ErrEmptyQuery                                                   = 1065
	ErrNonuniqTable                                                 = 1066
	ErrInvalidDefault                                               = 1067
	ErrMultiplePriKey                                               = 1068
	ErrTooManyKeys                                                  = 1069
	ErrTooManyKeyParts                                              = 1070
	ErrTooLongKey                                                   = 1071
	ErrKeyColumnDoesNotExits                                        = 1072
	ErrBlobUsedAsKey                                                = 1073
	ErrTooBigFieldlength                                            = 1074
	ErrWrongAutoKey                                                 = 1075
	ErrReady                                                        = 1076
	ErrNormalShutdown                                               = 1077
	ErrGotSignal                                                    = 1078
	ErrShutdownComplete                                             = 1079
	ErrForcingClose                                                 = 1080
	ErrIpsockError                                                  = 1081
	ErrNoSuchIndex                                                  = 1082
	ErrWrongFieldTerminators                                        = 1083
	ErrBlobsAndNoTerminated                                         = 1084
	ErrTextfileNotReadable                                          = 1085
	ErrFileExistsError                                              = 1086
	ErrLoadInfo                                                     = 1087
	ErrAlterInfo                                                    = 1088
	ErrWrongSubKey                                                  = 1089
	ErrCantRemoveAllFields                                          = 1090
	ErrCantDropFieldOrKey                                           = 1091
	ErrInsertInfo                                                   = 1092
	ErrUpdateTableUsed                                              = 1093
	ErrNoSuchThread                                                 = 1094
	ErrKillDeniedError                                              = 1095
	ErrNoTablesUsed                                                 = 1096
	ErrTooBigSet                                                    = 1097
	ErrNoUniqueLogfile                                              = 1098
	ErrTableNotLockedForWrite                                       = 1099
	ErrTableNotLocked                                               = 1100
	ErrBlobCantHaveDefault                                          = 1101
	ErrWrongDbName                                                  = 1102
	ErrWrongTableName                                               = 1103
	ErrTooBigSelect                                                 = 1104
	ErrUnknownError                                                 = 1105
	ErrUnknownProcedure                                             = 1106
	ErrWrongParamcountToProcedure                                   = 1107
	ErrWrongParametersToProcedure                                   = 1108
	ErrUnknownTable                                                 = 1109
	ErrFieldSpecifiedTwice                                          = 1110
	ErrInvalidGroupFuncUse                                          = 1111
	ErrUnsupportedExtension                                         = 1112
	ErrTableMustHaveColumns                                         = 1113
	ErrRecordFileFull                                               = 1114
	ErrUnknownCharacterSet                                          = 1115
	ErrTooManyTables                                                = 1116
	ErrTooManyFields                                                = 1117
	ErrTooBigRowsize                                                = 1118
	ErrStackOverrun                                                 = 1119
	ErrWrongOuterJoin                                               = 1120
	ErrNullColumnInIndex                                            = 1121
	ErrCantFindUdf                                                  = 1122
	ErrCantInitializeUdf                                            = 1123
	ErrUdfNoPaths                                                   = 1124
	ErrUdfExists                                                    = 1125
	ErrCantOpenLibrary                                              = 1126
	ErrCantFindDlEntry                                              = 1127
	ErrFunctionNotDefined                                           = 1128
	ErrHostIsBlocked                                                = 1129
	ErrHostNotPrivileged                                            = 1130
	ErrPasswordAnonymousUser                                        = 1131
	ErrPasswordNotAllowed                                           = 1132
	ErrPasswordNoMatch                                              = 1133
	ErrUpdateInfo                                                   = 1134
	ErrCantCreateThread                                             = 1135
	ErrWrongValueCountOnRow                                         = 1136
	ErrCantReopenTable                                              = 1137
	ErrInvalidUseOfNull                                             = 1138
	ErrRegexpError                                                  = 1139
	ErrMixOfGroupFuncAndFields                                      = 1140
	ErrNonexistingGrant                                             = 1141
	ErrTableaccessDeniedError                                       = 1142
	ErrColumnaccessDeniedError                                      = 1143
	ErrIllegalGrantForTable                                         = 1144
	ErrGrantWrongHostOrUser                                         = 1145
	ErrNoSuchTable                                                  = 1146
	ErrNonexistingTableGrant                                        = 1147
	ErrNotAllowedCommand                                            = 1148
	ErrSyntaxError                                                  = 1149
	ErrDelayedCantChangeLock                                        = 1150
	ErrTooManyDelayedThreads                                        = 1151
	ErrAbortingConnection                                           = 1152
	ErrNetPacketTooLarge                                            = 1153
	ErrNetReadErrorFromPipe                                         = 1154
	ErrNetFcntlError                                                = 1155
	ErrNetPacketsOutOfOrder                                         = 1156
	ErrNetUncompressError                                           = 1157
	ErrNetReadError                                                 = 1158
	ErrNetReadInterrupted                                           = 1159
	ErrNetErrorOnWrite                                              = 1160
	ErrNetWriteInterrupted                                          = 1161
	ErrTooLongString                                                = 1162
	ErrTableCantHandleBlob                                          = 1163
	ErrTableCantHandleAutoIncrement                                 = 1164
	ErrDelayedInsertTableLocked                                     = 1165
	ErrWrongColumnName                                              = 1166
	ErrWrongKeyColumn                                               = 1167
	ErrWrongMrgTable                                                = 1168
	ErrDupUnique                                                    = 1169
	ErrBlobKeyWithoutLength                                         = 1170
	ErrPrimaryCantHaveNull                                          = 1171
	ErrTooManyRows                                                  = 1172
	ErrRequiresPrimaryKey                                           = 1173
	ErrNoRaidCompiled                                               = 1174
	ErrUpdateWithoutKeyInSafeMode                                   = 1175
	ErrKeyDoesNotExits                                              = 1176
	ErrCheckNoSuchTable                                             = 1177
	ErrCheckNotImplemented                                          = 1178
	ErrCantDoThisDuringAnTransaction                                = 1179
	ErrErrorDuringCommit                                            = 1180
	ErrErrorDuringRollback                                          = 1181
	ErrErrorDuringFlushLogs                                         = 1182
	ErrErrorDuringCheckpoint                                        = 1183
	ErrNewAbortingConnection                                        = 1184
	ErrDumpNotImplemented                                           = 1185
	ErrFlushMasterBinlogClosed                                      = 1186
	ErrIndexRebuild                                                 = 1187
	ErrMaster                                                       = 1188
	ErrMasterNetRead                                                = 1189
	ErrMasterNetWrite                                               = 1190
	ErrFtMatchingKeyNotFound                                        = 1191
	ErrLockOrActiveTransaction                                      = 1192
	ErrUnknownSystemVariable                                        = 1193
	ErrCrashedOnUsage                                               = 1194
	ErrCrashedOnRepair                                              = 1195
	ErrWarningNotCompleteRollback                                   = 1196
	ErrTransCacheFull                                               = 1197
	ErrSlaveMustStop                                                = 1198
	ErrSlaveNotRunning                                              = 1199
	ErrBadSlave                                                     = 1200
	ErrMasterInfo                                                   = 1201
	ErrSlaveThread                                                  = 1202
	ErrTooManyUserConnections                                       = 1203
	ErrSetConstantsOnly                                             = 1204
	ErrLockWaitTimeout                                              = 1205
	ErrLockTableFull                                                = 1206
	ErrReadOnlyTransaction                                          = 1207
	ErrDropDbWithReadLock                                           = 1208
	ErrCreateDbWithReadLock                                         = 1209
	ErrWrongArguments                                               = 1210
	ErrNoPermissionToCreateUser                                     = 1211
	ErrUnionTablesInDifferentDir                                    = 1212
	ErrLockDeadlock                                                 = 1213
	ErrTableCantHandleFt                                            = 1214
	ErrCannotAddForeign                                             = 1215
	ErrNoReferencedRow                                              = 1216
	ErrRowIsReferenced                                              = 1217
	ErrConnectToMaster                                              = 1218
	ErrQueryOnMaster                                                = 1219
	ErrErrorWhenExecutingCommand                                    = 1220
	ErrWrongUsage                                                   = 1221
	ErrWrongNumberOfColumnsInSelect                                 = 1222
	ErrCantUpdateWithReadlock                                       = 1223
	ErrMixingNotAllowed                                             = 1224
	ErrDupArgument                                                  = 1225
	ErrUserLimitReached                                             = 1226
	ErrSpecificAccessDeniedError                                    = 1227
	ErrLocalVariable                                                = 1228
	ErrGlobalVariable                                               = 1229
	ErrNoDefault                                                    = 1230
	ErrWrongValueForVar                                             = 1231
	ErrWrongTypeForVar                                              = 1232
	ErrVarCantBeRead                                                = 1233
	ErrCantUseOptionHere                                            = 1234
	ErrNotSupportedYet                                              = 1235
	ErrMasterFatalErrorReadingBinlog                                = 1236
	ErrSlaveIgnoredTable                                            = 1237
	ErrIncorrectGlobalLocalVar                                      = 1238
	ErrWrongFkDef                                                   = 1239
	ErrKeyRefDoNotMatchTableRef                                     = 1240
	ErrOperandColumns                                               = 1241
	ErrSubqueryNo1Row                                               = 1242
	ErrUnknownStmtHandler                                           = 1243
	ErrCorruptHelpDb                                                = 1244
	ErrCyclicReference                                              = 1245
	ErrAutoConvert                                                  = 1246
	ErrIllegalReference                                             = 1247
	ErrDerivedMustHaveAlias                                         = 1248
	ErrSelectReduced                                                = 1249
	ErrTablenameNotAllowedHere                                      = 1250
	ErrNotSupportedAuthMode                                         = 1251
	ErrSpatialCantHaveNull                                          = 1252
	ErrCollationCharsetMismatch                                     = 1253
	ErrSlaveWasRunning                                              = 1254
	ErrSlaveWasNotRunning                                           = 1255
	ErrTooBigForUncompress                                          = 1256
	ErrZlibZMemError                                                = 1257
	ErrZlibZBufError                                                = 1258
	ErrZlibZDataError                                               = 1259
	ErrCutValueGroupConcat                                          = 1260
	ErrWarnTooFewRecords                                            = 1261
	ErrWarnTooManyRecords                                           = 1262
	ErrWarnNullToNotnull                                            = 1263
	ErrWarnDataOutOfRange                                           = 1264
	WarrnDataTruncated                                              = 1265
	ErrWarnUsingOtherHandler                                        = 1266
	ErrCantAggregate2collations                                     = 1267
	ErrDropUser                                                     = 1268
	ErrRevokeGrants                                                 = 1269
	ErrCantAggregate3collations                                     = 1270
	ErrCantAggregateNcollations                                     = 1271
	ErrVariableIsNotStruct                                          = 1272
	ErrUnknownCollation                                             = 1273
	ErrSlaveIgnoredSslParams                                        = 1274
	ErrServerIsInSecureAuthMode                                     = 1275
	ErrWarnFieldResolved                                            = 1276
	ErrBadSlaveUntilCond                                            = 1277
	ErrMissingSkipSlave                                             = 1278
	ErrUntilCondIgnored                                             = 1279
	ErrWrongNameForIndex                                            = 1280
	ErrWrongNameForCatalog                                          = 1281
	ErrWarnQcResize                                                 = 1282
	ErrBadFtColumn                                                  = 1283
	ErrUnknownKeyCache                                              = 1284
	ErrWarnHostnameWontWork                                         = 1285
	ErrUnknownStorageEngine                                         = 1286
	ErrWarnDeprecatedSyntax                                         = 1287
	ErrNonUpdatableTable                                            = 1288
	ErrFeatureDisabled                                              = 1289
	ErrOptionPreventsStatement                                      = 1290
	ErrDuplicatedValueInType                                        = 1291
	ErrTruncatedWrongValue                                          = 1292
	ErrTooMuchAutoTimestampCols                                     = 1293
	ErrInvalidOnUpdate                                              = 1294
	ErrUnsupportedPs                                                = 1295
	ErrGetErrmsg                                                    = 1296
	ErrGetTemporaryErrmsg                                           = 1297
	ErrUnknownTimeZone                                              = 1298
	ErrWarnInvalidTimestamp                                         = 1299
	ErrInvalidCharacterString                                       = 1300
	ErrWarnAllowedPacketOverflowed                                  = 1301
	ErrConflictingDeclarations                                      = 1302
	ErrSpNoRecursiveCreate                                          = 1303
	ErrSpAlreadyExists                                              = 1304
	ErrSpDoesNotExist                                               = 1305
	ErrSpDropFailed                                                 = 1306
	ErrSpStoreFailed                                                = 1307
	ErrSpLilabelMismatch                                            = 1308
	ErrSpLabelRedefine                                              = 1309
	ErrSpLabelMismatch                                              = 1310
	ErrSpUninitVar                                                  = 1311
	ErrSpBadselect                                                  = 1312
	ErrSpBadreturn                                                  = 1313
	ErrSpBadstatement                                               = 1314
	ErrUpdateLogDeprecatedIgnored                                   = 1315
	ErrUpdateLogDeprecatedTranslated                                = 1316
	ErrQueryInterrupted                                             = 1317
	ErrSpWrongNoOfArgs                                              = 1318
	ErrSpCondMismatch                                               = 1319
	ErrSpNoreturn                                                   = 1320
	ErrSpNoreturnend                                                = 1321
	ErrSpBadCursorQuery                                             = 1322
	ErrSpBadCursorSelect                                            = 1323
	ErrSpCursorMismatch                                             = 1324
	ErrSpCursorAlreadyOpen                                          = 1325
	ErrSpCursorNotOpen                                              = 1326
	ErrSpUndeclaredVar                                              = 1327
	ErrSpWrongNoOfFetchArgs                                         = 1328
	ErrSpFetchNoData                                                = 1329
	ErrSpDupParam                                                   = 1330
	ErrSpDupVar                                                     = 1331
	ErrSpDupCond                                                    = 1332
	ErrSpDupCurs                                                    = 1333
	ErrSpCantAlter                                                  = 1334
	ErrSpSubselectNyi                                               = 1335
	ErrStmtNotAllowedInSfOrTrg                                      = 1336
	ErrSpVarcondAfterCurshndlr                                      = 1337
	ErrSpCursorAfterHandler                                         = 1338
	ErrSpCaseNotFound                                               = 1339
	ErrFparserTooBigFile                                            = 1340
	ErrFparserBadHeader                                             = 1341
	ErrFparserEofInComment                                          = 1342
	ErrFparserErrorInParameter                                      = 1343
	ErrFparserEofInUnknownParameter                                 = 1344
	ErrViewNoExplain                                                = 1345
	ErrFrmUnknownType                                               = 1346
	ErrWrongObject                                                  = 1347
	ErrNonupdateableColumn                                          = 1348
	ErrViewSelectDerived                                            = 1349
	ErrViewSelectClause                                             = 1350
	ErrViewSelectVariable                                           = 1351
	ErrViewSelectTmptable                                           = 1352
	ErrViewWrongList                                                = 1353
	ErrWarnViewMerge                                                = 1354
	ErrWarnViewWithoutKey                                           = 1355
	ErrViewInvalid                                                  = 1356
	ErrSpNoDropSp                                                   = 1357
	ErrSpGotoInHndlr                                                = 1358
	ErrTrgAlreadyExists                                             = 1359
	ErrTrgDoesNotExist                                              = 1360
	ErrTrgOnViewOrTempTable                                         = 1361
	ErrTrgCantChangeRow                                             = 1362
	ErrTrgNoSuchRowInTrg                                            = 1363
	ErrNoDefaultForField                                            = 1364
	ErrDivisionByZero                                               = 1365
	ErrTruncatedWrongValueForField                                  = 1366
	ErrIllegalValueForType                                          = 1367
	ErrViewNonupdCheck                                              = 1368
	ErrViewCheckFailed                                              = 1369
	ErrProcaccessDeniedError                                        = 1370
	ErrRelayLogFail                                                 = 1371
	ErrPasswdLength                                                 = 1372
	ErrUnknownTargetBinlog                                          = 1373
	ErrIoErrLogIndexRead                                            = 1374
	ErrBinlogPurgeProhibited                                        = 1375
	ErrFseekFail                                                    = 1376
	ErrBinlogPurgeFatalErr                                          = 1377
	ErrLogInUse                                                     = 1378
	ErrLogPurgeUnknownErr                                           = 1379
	ErrRelayLogInit                                                 = 1380
	ErrNoBinaryLogging                                              = 1381
	ErrReservedSyntax                                               = 1382
	ErrWsasFailed                                                   = 1383
	ErrDiffGroupsProc                                               = 1384
	ErrNoGroupForProc                                               = 1385
	ErrOrderWithProc                                                = 1386
	ErrLoggingProhibitChangingOf                                    = 1387
	ErrNoFileMapping                                                = 1388
	ErrWrongMagic                                                   = 1389
	ErrPsManyParam                                                  = 1390
	ErrKeyPart0                                                     = 1391
	ErrViewChecksum                                                 = 1392
	ErrViewMultiupdate                                              = 1393
	ErrViewNoInsertFieldList                                        = 1394
	ErrViewDeleteMergeView                                          = 1395
	ErrCannotUser                                                   = 1396
	ErrXaerNota                                                     = 1397
	ErrXaerInval                                                    = 1398
	ErrXaerRmfail                                                   = 1399
	ErrXaerOutside                                                  = 1400
	ErrXaerRmerr                                                    = 1401
	ErrXaRbrollback                                                 = 1402
	ErrNonexistingProcGrant                                         = 1403
	ErrProcAutoGrantFail                                            = 1404
	ErrProcAutoRevokeFail                                           = 1405
	ErrDataTooLong                                                  = 1406
	ErrSpBadSqlstate                                                = 1407
	ErrStartup                                                      = 1408
	ErrLoadFromFixedSizeRowsToVar                                   = 1409
	ErrCantCreateUserWithGrant                                      = 1410
	ErrWrongValueForType                                            = 1411
	ErrTableDefChanged                                              = 1412
	ErrSpDupHandler                                                 = 1413
	ErrSpNotVarArg                                                  = 1414
	ErrSpNoRetset                                                   = 1415
	ErrCantCreateGeometryObject                                     = 1416
	ErrFailedRoutineBreakBinlog                                     = 1417
	ErrBinlogUnsafeRoutine                                          = 1418
	ErrBinlogCreateRoutineNeedSuper                                 = 1419
	ErrExecStmtWithOpenCursor                                       = 1420
	ErrStmtHasNoOpenCursor                                          = 1421
	ErrCommitNotAllowedInSfOrTrg                                    = 1422
	ErrNoDefaultForViewField                                        = 1423
	ErrSpNoRecursion                                                = 1424
	ErrTooBigScale                                                  = 1425
	ErrTooBigPrecision                                              = 1426
	ErrMBiggerThanD                                                 = 1427
	ErrWrongLockOfSystemTable                                       = 1428
	ErrConnectToForeignDataSource                                   = 1429
	ErrQueryOnForeignDataSource                                     = 1430
	ErrForeignDataSourceDoesntExist                                 = 1431
	ErrForeignDataStringInvalidCantCreate                           = 1432
	ErrForeignDataStringInvalid                                     = 1433
	ErrCantCreateFederatedTable                                     = 1434
	ErrTrgInWrongSchema                                             = 1435
	ErrStackOverrunNeedMore                                         = 1436
	ErrTooLongBody                                                  = 1437
	ErrWarnCantDropDefaultKeycache                                  = 1438
	ErrTooBigDisplaywidth                                           = 1439
	ErrXaerDupid                                                    = 1440
	ErrDatetimeFunctionOverflow                                     = 1441
	ErrCantUpdateUsedTableInSfOrTrg                                 = 1442
	ErrViewPreventUpdate                                            = 1443
	ErrPsNoRecursion                                                = 1444
	ErrSpCantSetAutocommit                                          = 1445
	ErrMalformedDefiner                                             = 1446
	ErrViewFrmNoUser                                                = 1447
	ErrViewOtherUser                                                = 1448
	ErrNoSuchUser                                                   = 1449
	ErrForbidSchemaChange                                           = 1450
	ErrRowIsReferenced2                                             = 1451
	ErrNoReferencedRow2                                             = 1452
	ErrSpBadVarShadow                                               = 1453
	ErrTrgNoDefiner                                                 = 1454
	ErrOldFileFormat                                                = 1455
	ErrSpRecursionLimit                                             = 1456
	ErrSpProcTableCorrupt                                           = 1457
	ErrSpWrongName                                                  = 1458
	ErrTableNeedsUpgrade                                            = 1459
	ErrSpNoAggregate                                                = 1460
	ErrMaxPreparedStmtCountReached                                  = 1461
	ErrViewRecursive                                                = 1462
	ErrNonGroupingFieldUsed                                         = 1463
	ErrTableCantHandleSpkeys                                        = 1464
	ErrNoTriggersOnSystemSchema                                     = 1465
	ErrRemovedSpaces                                                = 1466
	ErrAutoincReadFailed                                            = 1467
	ErrUsername                                                     = 1468
	ErrHostname                                                     = 1469
	ErrWrongStringLength                                            = 1470
	ErrNonInsertableTable                                           = 1471
	ErrAdminWrongMrgTable                                           = 1472
	ErrTooHighLevelOfNestingForSelect                               = 1473
	ErrNameBecomesEmpty                                             = 1474
	ErrAmbiguousFieldTerm                                           = 1475
	ErrForeignServerExists                                          = 1476
	ErrForeignServerDoesntExist                                     = 1477
	ErrIllegalHaCreateOption                                        = 1478
	ErrPartitionRequiresValuesError                                 = 1479
	ErrPartitionWrongValuesError                                    = 1480
	ErrPartitionMaxvalueError                                       = 1481
	ErrPartitionSubpartitionError                                   = 1482
	ErrPartitionSubpartMixError                                     = 1483
	ErrPartitionWrongNoPartError                                    = 1484
	ErrPartitionWrongNoSubpartError                                 = 1485
	ErrWrongExprInPartitionFuncError                                = 1486
	ErrNoConstExprInRangeOrListError                                = 1487
	ErrFieldNotFoundPartError                                       = 1488
	ErrListOfFieldsOnlyInHashError                                  = 1489
	ErrInconsistentPartitionInfoError                               = 1490
	ErrPartitionFuncNotAllowedError                                 = 1491
	ErrPartitionsMustBeDefinedError                                 = 1492
	ErrRangeNotIncreasingError                                      = 1493
	ErrInconsistentTypeOfFunctionsError                             = 1494
	ErrMultipleDefConstInListPartError                              = 1495
	ErrPartitionEntryError                                          = 1496
	ErrMixHandlerError                                              = 1497
	ErrPartitionNotDefinedError                                     = 1498
	ErrTooManyPartitionsError                                       = 1499
	ErrSubpartitionError                                            = 1500
	ErrCantCreateHandlerFile                                        = 1501
	ErrBlobFieldInPartFuncError                                     = 1502
	ErrUniqueKeyNeedAllFieldsInPf                                   = 1503
	ErrNoPartsError                                                 = 1504
	ErrPartitionMgmtOnNonpartitioned                                = 1505
	ErrForeignKeyOnPartitioned                                      = 1506
	ErrDropPartitionNonExistent                                     = 1507
	ErrDropLastPartition                                            = 1508
	ErrCoalesceOnlyOnHashPartition                                  = 1509
	ErrReorgHashOnlyOnSameNo                                        = 1510
	ErrReorgNoParamError                                            = 1511
	ErrOnlyOnRangeListPartition                                     = 1512
	ErrAddPartitionSubpartError                                     = 1513
	ErrAddPartitionNoNewPartition                                   = 1514
	ErrCoalescePartitionNoPartition                                 = 1515
	ErrReorgPartitionNotExist                                       = 1516
	ErrSameNamePartition                                            = 1517
	ErrNoBinlogError                                                = 1518
	ErrConsecutiveReorgPartitions                                   = 1519
	ErrReorgOutsideRange                                            = 1520
	ErrPartitionFunctionFailure                                     = 1521
	ErrPartStateError                                               = 1522
	ErrLimitedPartRange                                             = 1523
	ErrPluginIsNotLoaded                                            = 1524
	ErrWrongValue                                                   = 1525
	ErrNoPartitionForGivenValue                                     = 1526
	ErrFilegroupOptionOnlyOnce                                      = 1527
	ErrCreateFilegroupFailed                                        = 1528
	ErrDropFilegroupFailed                                          = 1529
	ErrTablespaceAutoExtendError                                    = 1530
	ErrWrongSizeNumber                                              = 1531
	ErrSizeOverflowError                                            = 1532
	ErrAlterFilegroupFailed                                         = 1533
	ErrBinlogRowLoggingFailed                                       = 1534
	ErrBinlogRowWrongTableDef                                       = 1535
	ErrBinlogRowRbrToSbr                                            = 1536
	ErrEventAlreadyExists                                           = 1537
	ErrEventStoreFailed                                             = 1538
	ErrEventDoesNotExist                                            = 1539
	ErrEventCantAlter                                               = 1540
	ErrEventDropFailed                                              = 1541
	ErrEventIntervalNotPositiveOrTooBig                             = 1542
	ErrEventEndsBeforeStarts                                        = 1543
	ErrEventExecTimeInThePast                                       = 1544
	ErrEventOpenTableFailed                                         = 1545
	ErrEventNeitherMExprNorMAt                                      = 1546
	ErrObsoleteColCountDoesntMatchCorrupted                         = 1547
	ErrObsoleteCannotLoadFromTable                                  = 1548
	ErrEventCannotDelete                                            = 1549
	ErrEventCompileError                                            = 1550
	ErrEventSameName                                                = 1551
	ErrEventDataTooLong                                             = 1552
	ErrDropIndexFk                                                  = 1553
	ErrWarnDeprecatedSyntaxWithVer                                  = 1554
	ErrCantWriteLockLogTable                                        = 1555
	ErrCantLockLogTable                                             = 1556
	ErrForeignDuplicateKeyOldUnused                                 = 1557
	ErrColCountDoesntMatchPleaseUpdate                              = 1558
	ErrTempTablePreventsSwitchOutOfRbr                              = 1559
	ErrStoredFunctionPreventsSwitchBinlogFormat                     = 1560
	ErrNdbCantSwitchBinlogFormat                                    = 1561
	ErrPartitionNoTemporary                                         = 1562
	ErrPartitionConstDomainError                                    = 1563
	ErrPartitionFunctionIsNotAllowed                                = 1564
	ErrDdlLogError                                                  = 1565
	ErrNullInValuesLessThan                                         = 1566
	ErrWrongPartitionName                                           = 1567
	ErrCantChangeTxCharacteristics                                  = 1568
	ErrDupEntryAutoincrementCase                                    = 1569
	ErrEventModifyQueueError                                        = 1570
	ErrEventSetVarError                                             = 1571
	ErrPartitionMergeError                                          = 1572
	ErrCantActivateLog                                              = 1573
	ErrRbrNotAvailable                                              = 1574
	ErrBase64DecodeError                                            = 1575
	ErrEventRecursionForbidden                                      = 1576
	ErrEventsDbError                                                = 1577
	ErrOnlyIntegersAllowed                                          = 1578
	ErrUnsuportedLogEngine                                          = 1579
	ErrBadLogStatement                                              = 1580
	ErrCantRenameLogTable                                           = 1581
	ErrWrongParamcountToNativeFct                                   = 1582
	ErrWrongParametersToNativeFct                                   = 1583
	ErrWrongParametersToStoredFct                                   = 1584
	ErrNativeFctNameCollision                                       = 1585
	ErrDupEntryWithKeyName                                          = 1586
	ErrBinlogPurgeEmfile                                            = 1587
	ErrEventCannotCreateInThePast                                   = 1588
	ErrEventCannotAlterInThePast                                    = 1589
	ErrSlaveIncident                                                = 1590
	ErrNoPartitionForGivenValueSilent                               = 1591
	ErrBinlogUnsafeStatement                                        = 1592
	ErrSlaveFatalError                                              = 1593
	ErrSlaveRelayLogReadFailure                                     = 1594
	ErrSlaveRelayLogWriteFailure                                    = 1595
	ErrSlaveCreateEventFailure                                      = 1596
	ErrSlaveMasterComFailure                                        = 1597
	ErrBinlogLoggingImpossible                                      = 1598
	ErrViewNoCreationCtx                                            = 1599
	ErrViewInvalidCreationCtx                                       = 1600
	ErrSrInvalidCreationCtx                                         = 1601
	ErrTrgCorruptedFile                                             = 1602
	ErrTrgNoCreationCtx                                             = 1603
	ErrTrgInvalidCreationCtx                                        = 1604
	ErrEventInvalidCreationCtx                                      = 1605
	ErrTrgCantOpenTable                                             = 1606
	ErrCantCreateSroutine                                           = 1607
	ErrNeverUsed                                                    = 1608
	ErrNoFormatDescriptionEventBeforeBinlogStatement                = 1609
	ErrSlaveCorruptEvent                                            = 1610
	ErrLoadDataInvalidColumn                                        = 1611
	ErrLogPurgeNoFile                                               = 1612
	ErrXaRbtimeout                                                  = 1613
	ErrXaRbdeadlock                                                 = 1614
	ErrNeedReprepare                                                = 1615
	ErrDelayedNotSupported                                          = 1616
	WarrnNoMasterInfo                                               = 1617
	WarrnOptionIgnored                                              = 1618
	WarrnPluginDeleteBuiltin                                        = 1619
	WarrnPluginBusy                                                 = 1620
	ErrVariableIsReadonly                                           = 1621
	ErrWarnEngineTransactionRollback                                = 1622
	ErrSlaveHeartbeatFailure                                        = 1623
	ErrSlaveHeartbeatValueOutOfRange                                = 1624
	ErrNdbReplicationSchemaError                                    = 1625
	ErrConflictFnParseError                                         = 1626
	ErrExceptionsWriteError                                         = 1627
	ErrTooLongTableComment                                          = 1628
	ErrTooLongFieldComment                                          = 1629
	ErrFuncInexistentNameCollision                                  = 1630
	ErrDatabaseName                                                 = 1631
	ErrTableName                                                    = 1632
	ErrPartitionName                                                = 1633
	ErrSubpartitionName                                             = 1634
	ErrTemporaryName                                                = 1635
	ErrRenamedName                                                  = 1636
	ErrTooManyConcurrentTrxs                                        = 1637
	WarrnNonAsciiSeparatorNotImplemented                            = 1638
	ErrDebugSyncTimeout                                             = 1639
	ErrDebugSyncHitLimit                                            = 1640
	ErrDupSignalSet                                                 = 1641
	ErrSignalWarn                                                   = 1642
	ErrSignalNotFound                                               = 1643
	ErrSignalException                                              = 1644
	ErrResignalWithoutActiveHandler                                 = 1645
	ErrSignalBadConditionType                                       = 1646
	WarrnCondItemTruncated                                          = 1647
	ErrCondItemTooLong                                              = 1648
	ErrUnknownLocale                                                = 1649
	ErrSlaveIgnoreServerIds                                         = 1650
	ErrQueryCacheDisabled                                           = 1651
	ErrSameNamePartitionField                                       = 1652
	ErrPartitionColumnListError                                     = 1653
	ErrWrongTypeColumnValueError                                    = 1654
	ErrTooManyPartitionFuncFieldsError                              = 1655
	ErrMaxvalueInValuesIn                                           = 1656
	ErrTooManyValuesError                                           = 1657
	ErrRowSinglePartitionFieldError                                 = 1658
	ErrFieldTypeNotAllowedAsPartitionField                          = 1659
	ErrPartitionFieldsTooLong                                       = 1660
	ErrBinlogRowEngineAndStmtEngine                                 = 1661
	ErrBinlogRowModeAndStmtEngine                                   = 1662
	ErrBinlogUnsafeAndStmtEngine                                    = 1663
	ErrBinlogRowInjectionAndStmtEngine                              = 1664
	ErrBinlogStmtModeAndRowEngine                                   = 1665
	ErrBinlogRowInjectionAndStmtMode                                = 1666
	ErrBinlogMultipleEnginesAndSelfLoggingEngine                    = 1667
	ErrBinlogUnsafeLimit                                            = 1668
	ErrBinlogUnsafeInsertDelayed                                    = 1669
	ErrBinlogUnsafeSystemTable                                      = 1670
	ErrBinlogUnsafeAutoincColumns                                   = 1671
	ErrBinlogUnsafeUdf                                              = 1672
	ErrBinlogUnsafeSystemVariable                                   = 1673
	ErrBinlogUnsafeSystemFunction                                   = 1674
	ErrBinlogUnsafeNontransAfterTrans                               = 1675
	ErrMessageAndStatement                                          = 1676
	ErrSlaveConversionFailed                                        = 1677
	ErrSlaveCantCreateConversion                                    = 1678
	ErrInsideTransactionPreventsSwitchBinlogFormat                  = 1679
	ErrPathLength                                                   = 1680
	ErrWarnDeprecatedSyntaxNoReplacement                            = 1681
	ErrWrongNativeTableStructure                                    = 1682
	ErrWrongPerfschemaUsage                                         = 1683
	ErrWarnISSkippedTable                                           = 1684
	ErrInsideTransactionPreventsSwitchBinlogDirect                  = 1685
	ErrStoredFunctionPreventsSwitchBinlogDirect                     = 1686
	ErrSpatialMustHaveGeomCol                                       = 1687
	ErrTooLongIndexComment                                          = 1688
	ErrLockAborted                                                  = 1689
	ErrDataOutOfRange                                               = 1690
	ErrWrongSpvarTypeInLimit                                        = 1691
	ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine              = 1692
	ErrBinlogUnsafeMixedStatement                                   = 1693
	ErrInsideTransactionPreventsSwitchSqlLogBin                     = 1694
	ErrStoredFunctionPreventsSwitchSqlLogBin                        = 1695
	ErrFailedReadFromParFile                                        = 1696
	ErrValuesIsNotIntTypeError                                      = 1697
	ErrAccessDeniedNoPasswordError                                  = 1698
	ErrSetPasswordAuthPlugin                                        = 1699
	ErrGrantPluginUserExists                                        = 1700
	ErrTruncateIllegalFk                                            = 1701
	ErrPluginIsPermanent                                            = 1702
	ErrSlaveHeartbeatValueOutOfRangeMin                             = 1703
	ErrSlaveHeartbeatValueOutOfRangeMax                             = 1704
	ErrStmtCacheFull                                                = 1705
	ErrMultiUpdateKeyConflict                                       = 1706
	ErrTableNeedsRebuild                                            = 1707
	WarrnOptionBelowLimit                                           = 1708
	ErrIndexColumnTooLong                                           = 1709
	ErrErrorInTriggerBody                                           = 1710
	ErrErrorInUnknownTriggerBody                                    = 1711
	ErrIndexCorrupt                                                 = 1712
	ErrUndoRecordTooBig                                             = 1713
	ErrBinlogUnsafeInsertIgnoreSelect                               = 1714
	ErrBinlogUnsafeInsertSelectUpdate                               = 1715
	ErrBinlogUnsafeReplaceSelect                                    = 1716
	ErrBinlogUnsafeCreateIgnoreSelect                               = 1717
	ErrBinlogUnsafeCreateReplaceSelect                              = 1718
	ErrBinlogUnsafeUpdateIgnore                                     = 1719
	ErrPluginNoUninstall                                            = 1720
	ErrPluginNoInstall                                              = 1721
	ErrBinlogUnsafeWriteAutoincSelect                               = 1722
	ErrBinlogUnsafeCreateSelectAutoinc                              = 1723
	ErrBinlogUnsafeInsertTwoKeys                                    = 1724
	ErrTableInFkCheck                                               = 1725
	ErrUnsupportedEngine                                            = 1726
	ErrBinlogUnsafeAutoincNotFirst                                  = 1727
	ErrCannotLoadFromTableV2                                        = 1728
	ErrMasterDelayValueOutOfRange                                   = 1729
	ErrOnlyFdAndRbrEventsAllowedInBinlogStatement                   = 1730
	ErrPartitionExchangeDifferentOption                             = 1731
	ErrPartitionExchangePartTable                                   = 1732
	ErrPartitionExchangeTempTable                                   = 1733
	ErrPartitionInsteadOfSubpartition                               = 1734
	ErrUnknownPartition                                             = 1735
	ErrTablesDifferentMetadata                                      = 1736
	ErrRowDoesNotMatchPartition                                     = 1737
	ErrBinlogCacheSizeGreaterThanMax                                = 1738
	ErrWarnIndexNotApplicable                                       = 1739
	ErrPartitionExchangeForeignKey                                  = 1740
	ErrNoSuchKeyValue                                               = 1741
	ErrRplInfoDataTooLong                                           = 1742
	ErrNetworkReadEventChecksumFailure                              = 1743
	ErrBinlogReadEventChecksumFailure                               = 1744
	ErrBinlogStmtCacheSizeGreaterThanMax                            = 1745
	ErrCantUpdateTableInCreateTableSelect                           = 1746
	ErrPartitionClauseOnNonpartitioned                              = 1747
	ErrRowDoesNotMatchGivenPartitionSet                             = 1748
	ErrNoSuchPartition_unused                                       = 1749
	ErrChangeRplInfoRepositoryFailure                               = 1750
	ErrWarningNotCompleteRollbackWithCreatedTempTable               = 1751
	ErrWarningNotCompleteRollbackWithDroppedTempTable               = 1752
	ErrMtsFeatureIsNotSupported                                     = 1753
	ErrMtsUpdatedDbsGreaterMax                                      = 1754
	ErrMtsCantParallel                                              = 1755
	ErrMtsInconsistentData                                          = 1756
	ErrFulltextNotSupportedWithPartitioning                         = 1757
	ErrDaInvalidConditionNumber                                     = 1758
	ErrInsecurePlainText                                            = 1759
	ErrInsecureChangeMaster                                         = 1760
	ErrForeignDuplicateKeyWithChildInfo                             = 1761
	ErrForeignDuplicateKeyWithoutChildInfo                          = 1762
	ErrSqlthreadWithSecureSlave                                     = 1763
	ErrTableHasNoFt                                                 = 1764
	ErrVariableNotSettableInSfOrTrigger                             = 1765
	ErrVariableNotSettableInTransaction                             = 1766
	ErrGtidNextIsNotInGtidNextList                                  = 1767
	ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull        = 1768
	ErrSetStatementCannotInvokeFunction                             = 1769
	ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull               = 1770
	ErrSkippingLoggedTransaction                                    = 1771
	ErrMalformedGtidSetSpecification                                = 1772
	ErrMalformedGtidSetEncoding                                     = 1773
	ErrMalformedGtidSpecification                                   = 1774
	ErrGnoExhausted                                                 = 1775
	ErrBadSlaveAutoPosition                                         = 1776
	ErrAutoPositionRequiresGtidModeOn                               = 1777
	ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet                   = 1778
	ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn                 = 1779
	ErrGtidModeRequiresBinlog                                       = 1780
	ErrCantSetGtidNextToGtidWhenGtidModeIsOff                       = 1781
	ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn                   = 1782
	ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff                = 1783
	ErrFoundGtidEventWhenGtidModeIsOff                              = 1784
	ErrGtidUnsafeNonTransactionalTable                              = 1785
	ErrGtidUnsafeCreateSelect                                       = 1786
	ErrGtidUnsafeCreateDropTemporaryTableInTransaction              = 1787
	ErrGtidModeCanOnlyChangeOneStepAtATime                          = 1788
	ErrMasterHasPurgedRequiredGtids                                 = 1789
	ErrCantSetGtidNextWhenOwningGtid                                = 1790
	ErrUnknownExplainFormat                                         = 1791
	ErrCantExecuteInReadOnlyTransaction                             = 1792
	ErrTooLongTablePartitionComment                                 = 1793
	ErrSlaveConfiguration                                           = 1794
	ErrInnodbFtLimit                                                = 1795
	ErrInnodbNoFtTempTable                                          = 1796
	ErrInnodbFtWrongDocidColumn                                     = 1797
	ErrInnodbFtWrongDocidIndex                                      = 1798
	ErrInnodbOnlineLogTooBig                                        = 1799
	ErrUnknownAlterAlgorithm                                        = 1800
	ErrUnknownAlterLock                                             = 1801
	ErrMtsChangeMasterCantRunWithGaps                               = 1802
	ErrMtsRecoveryFailure                                           = 1803
	ErrMtsResetWorkers                                              = 1804
	ErrColCountDoesntMatchCorruptedV2                               = 1805
	ErrSlaveSilentRetryTransaction                                  = 1806
	ErrDiscardFkChecksRunning                                       = 1807
	ErrTableSchemaMismatch                                          = 1808
	ErrTableInSystemTablespace                                      = 1809
	ErrIoReadError                                                  = 1810
	ErrIoWriteError                                                 = 1811
	ErrTablespaceMissing                                            = 1812
	ErrTablespaceExists                                             = 1813
	ErrTablespaceDiscarded                                          = 1814
	ErrInternalError                                                = 1815
	ErrInnodbImportError                                            = 1816
	ErrInnodbIndexCorrupt                                           = 1817
	ErrInvalidYearColumnLength                                      = 1818
	ErrNotValidPassword                                             = 1819
	ErrMustChangePassword                                           = 1820
	ErrFkNoIndexChild                                               = 1821
	ErrFkNoIndexParent                                              = 1822
	ErrFkFailAddSystem                                              = 1823
	ErrFkCannotOpenParent                                           = 1824
	ErrFkIncorrectOption                                            = 1825
	ErrFkDupName                                                    = 1826
	ErrPasswordFormat                                               = 1827
	ErrFkColumnCannotDrop                                           = 1828
	ErrFkColumnCannotDropChild                                      = 1829
	ErrFkColumnNotNull                                              = 1830
	ErrDupIndex                                                     = 1831
	ErrFkColumnCannotChange                                         = 1832
	ErrFkColumnCannotChangeChild                                    = 1833
	ErrFkCannotDeleteParent                                         = 1834
	ErrMalformedPacket                                              = 1835
	ErrReadOnlyMode                                                 = 1836
	ErrGtidNextTypeUndefinedGroup                                   = 1837
	ErrVariableNotSettableInSp                                      = 1838
	ErrCantSetGtidPurgedWhenGtidModeIsOff                           = 1839
	ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty                  = 1840
	ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty                    = 1841
	ErrGtidPurgedWasChanged                                         = 1842
	ErrGtidExecutedWasChanged                                       = 1843
	ErrBinlogStmtModeAndNoReplTables                                = 1844
	ErrAlterOperationNotSupported                                   = 1845
	ErrAlterOperationNotSupportedReason                             = 1846
	ErrAlterOperationNotSupportedReasonCopy                         = 1847
	ErrAlterOperationNotSupportedReasonPartition                    = 1848
	ErrAlterOperationNotSupportedReasonFkRename                     = 1849
	ErrAlterOperationNotSupportedReasonColumnType                   = 1850
	ErrAlterOperationNotSupportedReasonFkCheck                      = 1851
	ErrAlterOperationNotSupportedReasonIgnore                       = 1852
	ErrAlterOperationNotSupportedReasonNopk                         = 1853
	ErrAlterOperationNotSupportedReasonAutoinc                      = 1854
	ErrAlterOperationNotSupportedReasonHiddenFts                    = 1855
	ErrAlterOperationNotSupportedReasonChangeFts                    = 1856
	ErrAlterOperationNotSupportedReasonFts                          = 1857
	ErrSqlSlaveSkipCounterNotSettableInGtidMode                     = 1858
	ErrDupUnknownInIndex                                            = 1859
	ErrIdentCausesTooLongPath                                       = 1860
	ErrAlterOperationNotSupportedReasonNotNull                      = 1861
	ErrMustChangePasswordLogin                                      = 1862
	ErrRowInWrongPartition                                          = 1863
	ErrErrorLast                                                    = 1863
)

Variables

View Source
var ErrConnectFail = errors.New("connect fail.")
View Source
var ErrMasterSlaveSimilar = errors.New("master and salve is similar.")
View Source
var ErrNoRows = sql.ErrNoRows
View Source
var ErrReadOnly = Error{MySQLError: &mysql.MySQLError{Number: ErrReadOnlyMode, Message: "ReadOnly mode was open."}}

Functions

func ErrorEqual

func ErrorEqual(e error, code uint16) bool

func Escape

func Escape(sql string) string

Types

type DB

type DB struct {
	*WrapDB
	// contains filtered or unexported fields
}

func Open

func Open(host string, port int, user string, password string, dbname string, maxIdleConns int) (*DB, error)

func OpenConn

func OpenConn(cfg *DBConfig) (*DB, error)

func OpenEx

func OpenEx(host string, port int, user string, password string, dbname string,
	maxIdleConns int, maxConnection int, connectWaitTimeout time.Duration, charset string) (*DB, error)

OpenEx 提供了其他参数。关于 DSN,详见: https://github.com/go-sql-driver/mysql#dsn-data-source-name timeout 的格式与 time.ParseDuration 一致。 charset 以 mysql 提供的为准,详见:https://dev.mysql.com/doc/refman/5.5/en/charset-charsets.html

func OpenMasterSlave

func OpenMasterSlave(masterCfg *DBConfig, slaveCfg *DBConfig) (*DB, error)

func (*DB) Close

func (db *DB) Close()

func (*DB) Exec

func (db *DB) Exec(query string, args ...interface{}) (*Result, error)

func (*DB) Query

func (db *DB) Query(dest interface{}, query string, args ...interface{}) error

func (*DB) QueryInt64

func (db *DB) QueryInt64(query string) (int64, error)

func (*DB) QueryString

func (db *DB) QueryString(query string) (string, error)

func (*DB) SetLogger

func (db *DB) SetLogger(l *SqlLogger)

func (*DB) SetReadOnly

func (db *DB) SetReadOnly(readOnly bool)

func (*DB) SetSlowLogTimeout

func (db *DB) SetSlowLogTimeout(t time.Duration)

type DBConfig

type DBConfig struct {
	Host               string
	Port               int
	User               string
	Password           string
	DBName             string
	MaxIdleConns       int
	MaxConnection      int
	ConnectWaitTimeout time.Duration
	Charset            string
}

type Error

type Error struct {
	*mysql.MySQLError
}

func ToMySQLError

func ToMySQLError(e error) *Error

type NullBool

type NullBool struct {
	sql.NullBool
}

func (*NullBool) MarshalJSON

func (n *NullBool) MarshalJSON() ([]byte, error)

type NullFloat64

type NullFloat64 struct {
	sql.NullFloat64
}

func (*NullFloat64) MarshalJSON

func (n *NullFloat64) MarshalJSON() ([]byte, error)

type NullInt64

type NullInt64 struct {
	sql.NullInt64
}

func (*NullInt64) MarshalJSON

func (n *NullInt64) MarshalJSON() ([]byte, error)

type NullString

type NullString struct {
	sql.NullString
}

func (*NullString) MarshalJSON

func (n *NullString) MarshalJSON() ([]byte, error)

type Result

type Result struct {
	LastInsertId int64
	RowsAffected int64
}

type SqlLogger

type SqlLogger struct {
	// contains filtered or unexported fields
}

func NewSqlLogger

func NewSqlLogger(path string) (*SqlLogger, error)

func (*SqlLogger) Close

func (s *SqlLogger) Close()

func (*SqlLogger) Write

func (s *SqlLogger) Write(dur time.Duration, sql string)

type Status

type Status struct {
	Querying   sync.AtomicInt64
	QueryCount sync.AtomicUint64
	Executing  sync.AtomicInt64
	ExecCount  sync.AtomicUint64
	ErrCount   sync.AtomicUint64
	UsedTime   sync.AtomicDuration
}

type WrapDB

type WrapDB struct {
	*sqlx.DB
	Status *Status

	OpenSqlLog sync.AtomicBool
	// contains filtered or unexported fields
}

func (*WrapDB) Close

func (db *WrapDB) Close()

func (*WrapDB) Exec

func (db *WrapDB) Exec(query string, args ...interface{}) (*Result, error)

func (*WrapDB) Query

func (db *WrapDB) Query(dest interface{}, query string, args ...interface{}) error

func (*WrapDB) QueryInt64

func (db *WrapDB) QueryInt64(query string) (int64, error)

func (*WrapDB) QueryString

func (db *WrapDB) QueryString(query string) (string, error)

func (*WrapDB) SetLogger

func (db *WrapDB) SetLogger(l *SqlLogger)

func (*WrapDB) SetReadOnly

func (db *WrapDB) SetReadOnly(readOnly bool)

func (*WrapDB) SetSlowLogTimeout

func (db *WrapDB) SetSlowLogTimeout(t time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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