Update godoc.

This commit is contained in:
go-jet 2019-07-16 12:17:27 +02:00
parent 6f5d25ea9f
commit 57added50a
7 changed files with 28 additions and 17 deletions

View file

@ -19,6 +19,7 @@ _Support for additional databases will be added in future jet releases._
- [Benefits](#benefits) - [Benefits](#benefits)
- [Dependencies](#dependencies) - [Dependencies](#dependencies)
- [Versioning](#versioning) - [Versioning](#versioning)
- [License](#license)
## Features ## Features
1) Type-safe SQL Builder 1) Type-safe SQL Builder
@ -30,7 +31,8 @@ _Support for additional databases will be added in future jet releases._
* UPDATE (SET, WHERE, RETURNING), * UPDATE (SET, WHERE, RETURNING),
* DELETE (WHERE, RETURNING), * DELETE (WHERE, RETURNING),
* LOCK (IN, NOWAIT) * LOCK (IN, NOWAIT)
2) Auto-generated Data Model types - Go struct mapped to database type (table or enum) 2) Auto-generated Data Model types - Go struct mapped to database type (table or enum), used to store
result of database queries.
3) Query execution with mapping to arbitrary destination structure - destination structure can be 3) Query execution with mapping to arbitrary destination structure - destination structure can be
created by combining auto-generated data model types. created by combining auto-generated data model types.
@ -150,7 +152,7 @@ Note that every column has a type. String column `Language.Name` and `Category.N
string columns and expressions. `Actor.ActorID`, `FilmActor.ActorID`, `Film.Length` are integer columns string columns and expressions. `Actor.ActorID`, `FilmActor.ActorID`, `Film.Length` are integer columns
and can be compared only with integer columns and expressions. and can be compared only with integer columns and expressions.
__How get parametrized SQL query?__ __How to get parametrized SQL query?__
```go ```go
query, args, err := stmt.Sql() query, args, err := stmt.Sql()
``` ```
@ -524,10 +526,12 @@ To run the tests, additional dependencies are required:
- `github.com/pkg/profile` - `github.com/pkg/profile`
- `gotest.tools/assert` - `gotest.tools/assert`
## Contributing
## Versioning ## Versioning
[SemVer](http://semver.org/) is used for versioning. For the versions available, see the [releases](https://github.com/go-jet/jet/releases). [SemVer](http://semver.org/) is used for versioning. For the versions available, see the [releases](https://github.com/go-jet/jet/releases).
## Licence ## License
Copyright 2019 Goran Bjelanovic
Licensed under the Apache License, Version 2.0.

View file

@ -103,7 +103,8 @@ func (c columnImpl) serialize(statement statementType, out *sqlBuilder, options
} }
//------------------------------------------------------// //------------------------------------------------------//
// Dummy type for select * AllColumns
// Redefined type to support list of columns as projection
type ColumnList []Column type ColumnList []Column
// projection interface implementation // projection interface implementation
@ -131,7 +132,8 @@ func (cl ColumnList) serializeForProjection(statement statementType, out *sqlBui
return nil return nil
} }
// column interface implementation // dummy column interface implementation
func (cl ColumnList) Name() string { return "" } func (cl ColumnList) Name() string { return "" }
func (cl ColumnList) TableName() string { return "" } func (cl ColumnList) TableName() string { return "" }
func (cl ColumnList) setTableName(name string) {} func (cl ColumnList) setTableName(name string) {}

View file

@ -1,6 +1,5 @@
package jet package jet
//------------------------------------------------------//
type ColumnBool interface { type ColumnBool interface {
BoolExpression BoolExpression
column column
@ -37,6 +36,7 @@ func BoolColumn(name string) ColumnBool {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnFloat interface { type ColumnFloat interface {
FloatExpression FloatExpression
column column
@ -72,6 +72,7 @@ func FloatColumn(name string) ColumnFloat {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnInteger interface { type ColumnInteger interface {
IntegerExpression IntegerExpression
column column
@ -106,6 +107,7 @@ func IntegerColumn(name string) ColumnInteger {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnString interface { type ColumnString interface {
StringExpression StringExpression
column column
@ -140,6 +142,7 @@ func StringColumn(name string) ColumnString {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnTime interface { type ColumnTime interface {
TimeExpression TimeExpression
column column
@ -207,6 +210,7 @@ func TimezColumn(name string) ColumnTimez {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnTimestamp interface { type ColumnTimestamp interface {
TimestampExpression TimestampExpression
column column
@ -241,6 +245,7 @@ func TimestampColumn(name string) ColumnTimestamp {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnTimestampz interface { type ColumnTimestampz interface {
TimestampzExpression TimestampzExpression
column column
@ -275,6 +280,7 @@ func TimestampzColumn(name string) ColumnTimestampz {
} }
//------------------------------------------------------// //------------------------------------------------------//
type ColumnDate interface { type ColumnDate interface {
DateExpression DateExpression
column column

6
doc.go
View file

@ -1,3 +1,5 @@
// /*
Package Jet is a framework for writing type-safe SQL queries for PostgreSQL in Go, with ability
to easily convert database query result to desired arbitrary structure.
*/
package jet package jet

View file

@ -5,10 +5,8 @@ var autoGenWarningTemplate = `
// Code generated by go-jet DO NOT EDIT. // Code generated by go-jet DO NOT EDIT.
// Generated at {{now}} // Generated at {{now}}
// //
// WARNING: Changes to this file may cause incorrect behavior and will be lost // WARNING: Changes to this file may cause incorrect behavior
// if the code is regenerated // and will be lost if the code is regenerated
//
// Licence under: https://github.com/go-jet/jet/blob/master/LICENSE
// //
` `

View file

@ -4,9 +4,9 @@ import "errors"
//----------- Logical operators ---------------// //----------- Logical operators ---------------//
// Returns a representation of "not expr" // Returns negation of bool expression expr
func NOT(expr BoolExpression) BoolExpression { func NOT(exp BoolExpression) BoolExpression {
return newPrefixBoolOperator(expr, "NOT") return newPrefixBoolOperator(exp, "NOT")
} }
func BIT_NOT(expr IntegerExpression) IntegerExpression { func BIT_NOT(expr IntegerExpression) IntegerExpression {

View file

@ -5,7 +5,6 @@ type projection interface {
from(subQuery ExpressionTable) projection from(subQuery ExpressionTable) projection
} }
// Dummy type for projection list
type ProjectionList []projection type ProjectionList []projection
func (cl ProjectionList) from(subQuery ExpressionTable) projection { func (cl ProjectionList) from(subQuery ExpressionTable) projection {