From 57added50ad8304b2032bfe61ca97d69ec1f763d Mon Sep 17 00:00:00 2001 From: go-jet Date: Tue, 16 Jul 2019 12:17:27 +0200 Subject: [PATCH] Update godoc. --- README.md | 12 ++++++++---- column.go | 6 ++++-- column_types.go | 8 +++++++- doc.go | 6 ++++-- generator/postgres/templates.go | 6 ++---- operators.go | 6 +++--- projection.go | 1 - 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a371e83..062f0d0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ _Support for additional databases will be added in future jet releases._ - [Benefits](#benefits) - [Dependencies](#dependencies) - [Versioning](#versioning) + - [License](#license) ## Features 1) Type-safe SQL Builder @@ -30,7 +31,8 @@ _Support for additional databases will be added in future jet releases._ * UPDATE (SET, WHERE, RETURNING), * DELETE (WHERE, RETURNING), * 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 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 and can be compared only with integer columns and expressions. -__How get parametrized SQL query?__ +__How to get parametrized SQL query?__ ```go query, args, err := stmt.Sql() ``` @@ -524,10 +526,12 @@ To run the tests, additional dependencies are required: - `github.com/pkg/profile` - `gotest.tools/assert` -## Contributing ## Versioning [SemVer](http://semver.org/) is used for versioning. For the versions available, see the [releases](https://github.com/go-jet/jet/releases). -## Licence \ No newline at end of file +## License + +Copyright 2019 Goran Bjelanovic +Licensed under the Apache License, Version 2.0. \ No newline at end of file diff --git a/column.go b/column.go index 18695ed..16dc2ae 100644 --- a/column.go +++ b/column.go @@ -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 // projection interface implementation @@ -131,7 +132,8 @@ func (cl ColumnList) serializeForProjection(statement statementType, out *sqlBui return nil } -// column interface implementation +// dummy column interface implementation + func (cl ColumnList) Name() string { return "" } func (cl ColumnList) TableName() string { return "" } func (cl ColumnList) setTableName(name string) {} diff --git a/column_types.go b/column_types.go index 63b614c..f3a1f69 100644 --- a/column_types.go +++ b/column_types.go @@ -1,6 +1,5 @@ package jet -//------------------------------------------------------// type ColumnBool interface { BoolExpression column @@ -37,6 +36,7 @@ func BoolColumn(name string) ColumnBool { } //------------------------------------------------------// + type ColumnFloat interface { FloatExpression column @@ -72,6 +72,7 @@ func FloatColumn(name string) ColumnFloat { } //------------------------------------------------------// + type ColumnInteger interface { IntegerExpression column @@ -106,6 +107,7 @@ func IntegerColumn(name string) ColumnInteger { } //------------------------------------------------------// + type ColumnString interface { StringExpression column @@ -140,6 +142,7 @@ func StringColumn(name string) ColumnString { } //------------------------------------------------------// + type ColumnTime interface { TimeExpression column @@ -207,6 +210,7 @@ func TimezColumn(name string) ColumnTimez { } //------------------------------------------------------// + type ColumnTimestamp interface { TimestampExpression column @@ -241,6 +245,7 @@ func TimestampColumn(name string) ColumnTimestamp { } //------------------------------------------------------// + type ColumnTimestampz interface { TimestampzExpression column @@ -275,6 +280,7 @@ func TimestampzColumn(name string) ColumnTimestampz { } //------------------------------------------------------// + type ColumnDate interface { DateExpression column diff --git a/doc.go b/doc.go index 64b11fd..2a48dca 100644 --- a/doc.go +++ b/doc.go @@ -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 diff --git a/generator/postgres/templates.go b/generator/postgres/templates.go index 33fab25..87a8de5 100644 --- a/generator/postgres/templates.go +++ b/generator/postgres/templates.go @@ -5,10 +5,8 @@ var autoGenWarningTemplate = ` // Code generated by go-jet DO NOT EDIT. // Generated at {{now}} // -// WARNING: Changes to this file may cause incorrect behavior and will be lost -// if the code is regenerated -// -// Licence under: https://github.com/go-jet/jet/blob/master/LICENSE +// WARNING: Changes to this file may cause incorrect behavior +// and will be lost if the code is regenerated // ` diff --git a/operators.go b/operators.go index ca3941f..fd12932 100644 --- a/operators.go +++ b/operators.go @@ -4,9 +4,9 @@ import "errors" //----------- Logical operators ---------------// -// Returns a representation of "not expr" -func NOT(expr BoolExpression) BoolExpression { - return newPrefixBoolOperator(expr, "NOT") +// Returns negation of bool expression expr +func NOT(exp BoolExpression) BoolExpression { + return newPrefixBoolOperator(exp, "NOT") } func BIT_NOT(expr IntegerExpression) IntegerExpression { diff --git a/projection.go b/projection.go index 0a3c202..361e26f 100644 --- a/projection.go +++ b/projection.go @@ -5,7 +5,6 @@ type projection interface { from(subQuery ExpressionTable) projection } -// Dummy type for projection list type ProjectionList []projection func (cl ProjectionList) from(subQuery ExpressionTable) projection {