mydb/errors.go
2023-09-18 15:15:42 +08:00

43 lines
2.7 KiB
Go

package mydb
import (
"errors"
)
// Error messages
var (
ErrMissingAdapter = errors.New(`mydb: missing adapter`)
ErrAlreadyWithinTransaction = errors.New(`mydb: already within a transaction`)
ErrCollectionDoesNotExist = errors.New(`mydb: collection does not exist`)
ErrExpectingNonNilModel = errors.New(`mydb: expecting non nil model`)
ErrExpectingPointerToStruct = errors.New(`mydb: expecting pointer to struct`)
ErrGivingUpTryingToConnect = errors.New(`mydb: giving up trying to connect: too many clients`)
ErrInvalidCollection = errors.New(`mydb: invalid collection`)
ErrMissingCollectionName = errors.New(`mydb: missing collection name`)
ErrMissingConditions = errors.New(`mydb: missing selector conditions`)
ErrMissingConnURL = errors.New(`mydb: missing DSN`)
ErrMissingDatabaseName = errors.New(`mydb: missing database name`)
ErrNoMoreRows = errors.New(`mydb: no more rows in this result set`)
ErrNotConnected = errors.New(`mydb: not connected to a database`)
ErrNotImplemented = errors.New(`mydb: call not implemented`)
ErrQueryIsPending = errors.New(`mydb: can't execute this instruction while the result set is still open`)
ErrQueryLimitParam = errors.New(`mydb: a query can accept only one limit parameter`)
ErrQueryOffsetParam = errors.New(`mydb: a query can accept only one offset parameter`)
ErrQuerySortParam = errors.New(`mydb: a query can accept only one order-by parameter`)
ErrSockerOrHost = errors.New(`mydb: you may connect either to a UNIX socket or a TCP address, but not both`)
ErrTooManyClients = errors.New(`mydb: can't connect to database server: too many clients`)
ErrUndefined = errors.New(`mydb: value is undefined`)
ErrUnknownConditionType = errors.New(`mydb: arguments of type %T can't be used as constraints`)
ErrUnsupported = errors.New(`mydb: action is not supported by the DBMS`)
ErrUnsupportedDestination = errors.New(`mydb: unsupported destination type`)
ErrUnsupportedType = errors.New(`mydb: type does not support marshaling`)
ErrUnsupportedValue = errors.New(`mydb: value does not support unmarshaling`)
ErrNilRecord = errors.New(`mydb: invalid item (nil)`)
ErrRecordIDIsZero = errors.New(`mydb: item ID is not defined`)
ErrMissingPrimaryKeys = errors.New(`mydb: collection %q has no primary keys`)
ErrWarnSlowQuery = errors.New(`mydb: slow query`)
ErrTransactionAborted = errors.New(`mydb: transaction was aborted`)
ErrNotWithinTransaction = errors.New(`mydb: not within transaction`)
ErrNotSupportedByAdapter = errors.New(`mydb: not supported by adapter`)
)