Releases: piotrkowalczuk/pqt
Releases · piotrkowalczuk/pqt
Version 0.1.0
Changelog
- array support - golang postgres driver do not support arrays natively, pqt comes with help:
- pqt.ArrayInt64 - wrapper for []int64
- pqt.ArrayFloat64 - wrapper for []float64
- pqt.ArrayString - wrapper for []string
- sql generation
- go generation - it includes:
entity
- struct that reflects single row within the databasecriteria
- object that can be passed to theFind
method, it allows to create complex queriespatch
- structure used byUpdateBy<primary-key>
methods to modify existing entityiterator
- structure used byFindIter
methods as a result, it wrapssql.Rows
constants
:table names
column names
constraints
- library generates exact names of each constraint and corresponding constant that allow to easily handle query errors using ErrorConstraint helper function
repository
- data access layer that expose API to manipulate entities:Count
- returns number of entities for given criteriaFind
- returns collection of entities that match given criteriaFindIter
- works likeFind
but returnsiterator
Insert
- saves given entity into the databaseFindOneBy<primary-key>
- retrieves single entityUpdateBy<primary-key>
- modifies single entityDeleteBy<primary-key>
- modifies single entity
func Scan<Entity>Rows(rows *sql.Rows) ([]*<entity>Entity, error) {
helper function
- schema definition - allow to programmatically define database schema, that includes:
schemas
tables
columns
constraints
relationships
Version 0.2.0
Changelog
- pqt
- pqt.JSONArrayInt64 - wrapper for []int64, it generates JSONB compatible array
[]
instead of{}
- pqt.JSONArrayFloat64 - wrapper for []float64, it generates JSONB compatible array
[]
instead of{}
- pqt.JSONArrayString - wrapper for []string, it generates JSONB compatible array
[]
instead of{}
Criterion
interface replaced bypqtgo.CompositionWriter
- pqt.JSONArrayInt64 - wrapper for []int64, it generates JSONB compatible array
- pqtgo
Arguments
,PlaceholderWriter
replaced by pqtgo.Composer, builder like object that keeps buffer and arguments but also tracks positional parameters.- pqtgo.CompositionWriter - interface used by generator, allows custom structs to be used as a criteria parameter
- pqtgo.WriteCompositionQueryInt64 - helper function that generate SQL for qtypes.Int64 object.
- pqtgo.WriteCompositionQueryString - helper function that generate SQL for qtypes.String object.
Version 0.1.1
Changelog
- Now
pqt.TypeJSON
andpqt.TypeJSONB
generates[]byte
by default .