Documentation ¶
Index ¶
- Constants
- Variables
- func BuildPlaceholder(count int) string
- func PlaceholderRepeat(placeholder string, repeat int) []string
- func ToDriverValueFromStringArray(collection []string) []driver.Value
- type Error
- type FilterIn
- type FilterIns
- type FilterItem
- type FilterItems
- type Filters
- type FindBy
- type IHelper
- type IHelperOption
- type JsonArray
- type JsonObject
- type Manager
- type NullableTime
- type Operator
- type Option
- type OrderBy
- type OrdersBy
- type Pagination
- type PqArrayOfString
- type Separator
- type Sort
- type SupportedDriver
- type ValueKey
Constants ¶
View Source
const ( DefaultOffset = 0 DefaultPage = 1 DefaultLimit = 10 )
Variables ¶
View Source
var ( ErrorRecordNotFound error = NewError(404, "record not found") ErrorRecordAlreadyExists error = NewError(409, "record already exists") )
View Source
var EmptyJsonArray = &JsonArray{ JSONText: emptyJSONArray, Valid: true, }
View Source
var EmptyJsonObject = &JsonObject{ JSONText: emptyJSON, Valid: true, }
Functions ¶
func BuildPlaceholder ¶
func PlaceholderRepeat ¶
Types ¶
type FilterItem ¶
type FilterItems ¶
type FilterItems []FilterItem
type Filters ¶
type Filters struct { Ands FilterItems Ors FilterItems Ins FilterIns In *FilterIn }
func (*Filters) BuildWithWherePrefix ¶
type IHelper ¶
type IHelper interface { BuildSqlAndArgs() (string, []interface{}) BuildSqlAndArgsWithWherePrefix() (string, []interface{}) BuildSqlAndArgsFilterOnly() (string, []interface{}) BuildSqlAndArgsFilterOnlyWithWherePrefix() (string, []interface{}) OrdersBy() OrdersBy Filters() *Filters Pagination() *Pagination }
func NewHelper ¶
func NewHelper(separator Separator, opts ...IHelperOption) IHelper
type IHelperOption ¶
type IHelperOption interface {
// contains filtered or unexported methods
}
func WithFilters ¶
func WithFilters(v Filters) IHelperOption
func WithOrderBy ¶
func WithOrderBy(v OrderBy) IHelperOption
func WithOrdersBy ¶
func WithOrdersBy(v OrdersBy) IHelperOption
func WithPagination ¶
func WithPagination(page, limit int) IHelperOption
type JsonArray ¶
func ToJsonArray ¶
func ToJsonArray(v []interface{}) *JsonArray
type JsonObject ¶
func ToJsonObjectFromInterface ¶
func ToJsonObjectFromInterface(v interface{}) *JsonObject
func ToJsonObjectFromMap ¶
func ToJsonObjectFromMap(v map[string]interface{}) *JsonObject
func (*JsonObject) Scan ¶
func (n *JsonObject) Scan(value interface{}) error
Scan implements the Scanner interface.
type Manager ¶
type Manager interface { MustConnect(ctx context.Context) Manager Connect(ctx context.Context) error SqlMock() sqlmock.Sqlmock Rebind(query string) string Query(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error) QueryRow(ctx context.Context, query string, args ...interface{}) *sqlx.Row NamedQuery(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) MustExec(ctx context.Context, query string, args ...interface{}) sql.Result NamedExec(ctx context.Context, query string, arg interface{}) (sql.Result, error) MustBegin(ctx context.Context, opts *sql.TxOptions) *sqlx.Tx Begin(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error) Prepare(ctx context.Context, query string) (*sqlx.Stmt, error) PrepareNamed(ctx context.Context, query string) (*sqlx.NamedStmt, error) DSN() string Driver() SupportedDriver Ping() error SetTelemetry(tm telemetry.Manager) Manager }
func NewWithMock ¶
func NewWithMock() Manager
type NullableTime ¶
func (NullableTime) Base ¶
func (a NullableTime) Base() *sql.NullTime
func (NullableTime) From ¶
func (a NullableTime) From(dt *time.Time) NullableTime
func (NullableTime) GetTime ¶
func (a NullableTime) GetTime() *time.Time
func (*NullableTime) Scan ¶
func (a *NullableTime) Scan(src interface{}) error
Scan implements the sql.Scanner interface.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithMaxIdleConnection ¶
func WithMaxOpenConnection ¶
func WithOTelConnect ¶
func WithTelemetry ¶ added in v0.2.1
func WithTelemetryEnabled ¶ added in v0.2.1
type Pagination ¶
func (Pagination) Build ¶
func (p Pagination) Build() string
func (Pagination) BuildWithSpacePrefix ¶
func (p Pagination) BuildWithSpacePrefix() string
type PqArrayOfString ¶
type PqArrayOfString pq.StringArray
func (*PqArrayOfString) Scan ¶
func (a *PqArrayOfString) Scan(src interface{}) error
Scan implements the sql.Scanner interface.
type SupportedDriver ¶
type SupportedDriver string
const ( DriverMySQL SupportedDriver = "mysql" DriverPostgreSQL SupportedDriver = "postgres" // DriverSqlServer ref: https://gist.github.com/rossnelson/cbb192d314b6c89b7148e919ab25986c DriverSqlServer SupportedDriver = "mssql" DriverMock SupportedDriver = "sqlmock" )
func (SupportedDriver) String ¶
func (d SupportedDriver) String() string
func (SupportedDriver) ToSqlBuilderFlavor ¶
func (d SupportedDriver) ToSqlBuilderFlavor() sqlbuilder.Flavor
Click to show internal directories.
Click to hide internal directories.