go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/db/errors.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package db
     9  
    10  import "errors"
    11  
    12  var (
    13  	// ErrDestinationNotStruct is an exception class.
    14  	ErrDestinationNotStruct = errors.New("destination object is not a struct")
    15  	// ErrConfigUnset is an exception class.
    16  	ErrConfigUnset = errors.New("config is unset")
    17  	// ErrUnsafeSSLMode is an error indicating unsafe ssl mode in production.
    18  	ErrUnsafeSSLMode = errors.New("unsafe ssl mode in prodlike environment")
    19  	// ErrUsernameUnset is an error indicating there is no username set in a prodlike environment.
    20  	ErrUsernameUnset = errors.New("username is unset in prodlike environment")
    21  	// ErrPasswordUnset is an error indicating there is no password set in a prodlike environment.
    22  	ErrPasswordUnset = errors.New("password is unset in prodlike environment")
    23  	// ErrDurationConversion is the error returned when a duration cannot be
    24  	// converted to multiple of some base (e.g. milliseconds or seconds)
    25  	// without round off.
    26  	ErrDurationConversion = errors.New("cannot convert duration")
    27  	// ErrConnectionAlreadyOpen is an error indicating the db connection was already opened.
    28  	ErrConnectionAlreadyOpen = errors.New("the connection is already opened")
    29  	// ErrConnectionClosed is an error indicating the db connection hasn't been opened.
    30  	ErrConnectionClosed = errors.New("the connection is closed, or is being used before opened")
    31  	// ErrContextUnset is an error indicating the context on the invocation isn't set.
    32  	ErrContextUnset = errors.New("the context is unset; cannot continue")
    33  	// ErrCollectionNotSlice is an error returned by OutMany if the destination is not a slice.
    34  	ErrCollectionNotSlice = errors.New("outmany destination collection is not a slice")
    35  	// ErrInvalidIDs is an error returned by Get if the ids aren't provided.
    36  	ErrInvalidIDs = errors.New("invalid `ids` parameter")
    37  	// ErrNoPrimaryKey is an error returned by a number of operations that depend on a primary key.
    38  	ErrNoPrimaryKey = errors.New("no primary key on object")
    39  	// ErrRowsNotColumnsProvider is returned by `PopulateByName` if you do not pass in `sql.Rows` as the scanner.
    40  	ErrRowsNotColumnsProvider = errors.New("rows is not a columns provider")
    41  	// ErrTooManyRows is returned by Out if there is more than one row returned by the query
    42  	ErrTooManyRows = errors.New("too many rows returned to map to single object")
    43  	// ErrNetwork is a grouped error for network issues.
    44  	ErrNetwork = errors.New("network error")
    45  )