Categorygithub.com/mono83/sqlt
modulepackage
1.7.2
Repository: https://github.com/mono83/sqlt.git
Documentation: pkg.go.dev

# README

sqlt

GitHub go.mod Go version GitHub release (latest by date) Go Report Card

Minimal set of useful things to work with database in Go.

Installation

go get -u github.com/mono83/sqlt

Provided custom types

  • sqlt.TrueFalse - to read boolean value stored in database as enum(true,false)
  • sqlt.UnixSecinds - to read time.Time value stored in database as integer unix timestamp in seconds

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

InsertID returns auto incremental identifier of last inserted entity as int64.
InsertIDU returns auto incremental identifier of last inserted entity as uint64.
IterateScan scans given rows ony by one passing obtained data to callback function.
IterateScanE scans given rows ony by one passing obtained data to callback function.
PlaceholdersString constructs placeholders string like ?,?,?.
StdConvert performs conversion from interface{} to defined in sql.ColumnType type using standard ruleset.

# Variables

ErrCallbackNotSet is returned by CallbackDB when callback for corresponding method not set.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

CallbackDB is the simplest implementation of ReaderExecutor interface providing to configure which function will be invoked on corresponding method.
Rowset is plain two-dimensional data table containing data, obtained from SQL database in non-structured way (via interface{}).

# Interfaces

Executor is a thin interface for database connection capable to modify data.
Getter is a thin interface for database connection capable to read data.
Querier is a thin interface for database connection capable to query data.
QuerierExecutor is a thin interface for database connection capable to both read and write data.
Reader is an interface defining connection able to perform read operations.
ReaderExecutor is a thin interface for database connection capable to both read and write data.
Selector is a thin interface for database connection capable to read data.

# Type aliases

DurationNanos is type duration in nanoseconds.
GenericListReader defines accessor to database providing ability to read list(slice) of records of type [T] using slice of identifiers of type [I].
GenericReader defines accessor to database providing ability to read single entity of type [T] using identifier with type [I].
JSON wraps value stored in JSON format.
TrueFalse wraps values stored in database as enum(true,false).
UnixMillis is type containing timestamp in unix milliseconds.
UnixSeconds is type containing timestamp in unix seconds.