Package sqlbuilder is a Standard Query Language builder for golang supporting Sqlite3, MySQL and Postgres See https://github.com/go-corelibs/go-sqlbuilder for more information
Package esquery provides a non-obtrusive, idiomatic and easy-to-use query and aggregation builder for the official Go client (https://github.com/elastic/go-elasticsearch) for the ElasticSearch database (https://www.elastic.co/products/elasticsearch). esquery alleviates the need to use extremely nested maps (map[string]interface{}) and serializing queries to JSON manually. It also helps eliminating common mistakes such as misspelling query types, as everything is statically typed. Using `esquery` can make your code much easier to write, read and maintain, and significantly reduce the amount of code you write. esquery provides a method chaining-style API for building and executing queries and aggregations. It does not wrap the official Go client nor does it require you to change your existing code in order to integrate the library. Queries can be directly built with `esquery`, and executed by passing an `*elasticsearch.Client` instance (with optional search parameters). Results are returned as-is from the official client (e.g. `*esapi.Response` objects). Getting started is extremely simple: esquery currently supports version 7 of the ElasticSearch Go client. The library cannot currently generate "short queries". For example, whereas ElasticSearch can accept this: { "query": { "term": { "user": "Kimchy" } } } The library will always generate this: This is also true for queries such as "bool", where fields like "must" can either receive one query object, or an array of query objects. `esquery` will generate an array even if there's only one query object.
Package influx provides a query builder to ease the writing of query to InfluxDB with the InfluxQL language. After instantiating a new query object with NewQuery, call the different methods to adapt the query to fit your needs. You can call Build to get the InfluxQL query in a string form. Eventually call Do to actually execute the query. Example Usage
Package influx provides a query builder to ease the writing of query to InfluxDB with the InfluxQL language. After instantiating a new query object with NewQuery, call the different methods to adapt the query to fit your needs. You can call Build to get the InfluxQL query in a string form. Eventually call Do to actually execute the query. Example Usage
Package qb is a simple query builder.
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. This example shows how to do CRUD operations. This example shows how to populate DB data in different ways. This example shows how to use query builder to build DB queries. This example shows how to use query builder in transactions.
Package gocqlx is an idiomatic extension to gocql that provides usability features. With gocqlx you can bind the query parameters from maps and structs, use named query parameters (:identifier) and scan the query results into structs and slices. It comes with a fluent and flexible CQL query builder and a database migrations module.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/GlebBeloded/goqu for an introduction to goqu.
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. This example shows how to do CRUD operations. This example shows how to populate DB data in different ways. This example shows how to use query builder to build DB queries. This example shows how to use query builder in transactions.
Package forest has functions for REST Api testing in Go This package provides a few simple helper types and functions to create functional tests that call HTTP services. A test uses a forest Client which encapsulates a standard http.Client and a base url. Such a client can be created inside a function or by initializing a package variable for shared access. Using a client, you can send http requests and call multiple expectation functions on each response. Most functions of the forest package take the *testing.T variable as an argument to report any error. Example To compose http requests, you create a RequestConfig value which as a Builder interface for setting the path,query,header and body parameters. The ProcessTemplate function can be useful to create textual payloads. To inspect http responses, you use the Expect functions that perform the unmarshalling or use XMLPath or JSONPath functions directly on the response. If needed, implement the standard TestMain to do global setup and teardown. In contrast to the standard behavior, the Body of a http.Response is made re-readable. This means one can apply expectations to a response as well as dump the full contents. The function XMLPath provides XPath expression support. It uses the [https://godoc.org/launchpad.net/xmlpath] package. The similar function JSONPath can be used on JSON documents. Colorizes error output (can be configured using package vars). All functions can also be used in a setup and teardown as part of TestMain. (c) 2015, http://ernestmicklei.com. MIT License
Package jet is a framework for writing type-safe SQL queries in Go, with ability to easily convert database query result into desired arbitrary object structure. Use the bellow command to install jet Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line. *Make sure GOPATH bin folder is added to the PATH environment variable. Jet requires already defined database schema(with tables, enums etc), so that jet generator can generate SQL Builder and Model files. File generation is very fast, and can be added as every pre-build step. Sample command: Then next step is to import generated SQL Builder and Model files and write SQL queries in Go: To write SQL queries for PostgreSQL import: To write SQL queries for MySQL and MariaDB import: *Dot import is used so that Go code resemble as much as native SQL. Dot import is not mandatory. Write SQL: Store result into desired destination: Detail info about all features and use cases can be found at project wiki page - https://github.com/go-jet/jet/wiki.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
Provides SQL table metadata, enabling select field lists, easy getters, relations when using a query builder.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
Provides SQL table metadata, enabling select field lists, easy getters, relations when using a query builder.
Package gocqlx is an idiomatic extension to gocql that provides usability features. With gocqlx you can bind the query parameters from maps and structs, use named query parameters (:identifier) and scan the query results into structs and slices. It comes with a fluent and flexible CQL query builder and a database migrations module.
Package esquery provides a non-obtrusive, idiomatic and easy-to-use query and aggregation builder for the official Go client (https://github.com/elastic/go-elasticsearch) for the ElasticSearch database (https://www.elastic.co/products/elasticsearch). esquery alleviates the need to use extremely nested maps (map[string]interface{}) and serializing queries to JSON manually. It also helps eliminating common mistakes such as misspelling query types, as everything is statically typed. Using `esquery` can make your code much easier to write, read and maintain, and significantly reduce the amount of code you write. esquery provides a method chaining-style API for building and executing queries and aggregations. It does not wrap the official Go client nor does it require you to change your existing code in order to integrate the library. Queries can be directly built with `esquery`, and executed by passing an `*elasticsearch.Client` instance (with optional search parameters). Results are returned as-is from the official client (e.g. `*esapi.Response` objects). Getting started is extremely simple: esquery currently supports version 7 of the ElasticSearch Go client. The library cannot currently generate "short queries". For example, whereas ElasticSearch can accept this: { "query": { "term": { "user": "Kimchy" } } } The library will always generate this: This is also true for queries such as "bool", where fields like "must" can either receive one query object, or an array of query objects. `esquery` will generate an array even if there's only one query object.
Provides SQL table metadata, enabling select field lists, easy getters, relations when using a query builder.
Package loukoum provides a simple SQL Query Builder. At the moment, only PostgreSQL is supported. If you have to generate complex queries, which rely on various contexts, loukoum is the right tool for you. It helps you generate SQL queries from composable parts. However, keep in mind it's not an ORM or a Mapper so you have to use a SQL connector (like "database/sql" or "sqlx", for example) to execute queries. If you're afraid to slip a tiny SQL injection manipulating fmt (or a byte buffer...) when you append conditions, loukoum is here to protect you against yourself. For further informations, you can read this documentation: https://github.com/DzananGanic/loukoum/blob/master/README.md Or you can discover loukoum with these examples. An "insert" can be generated like that: Also, if you need an upsert, you can define a "on conflict" clause: Updating a news is also simple: You can remove a specific user: Or select a list of users...
Package esquery provides a non-obtrusive, idiomatic and easy-to-use query and aggregation builder for the official Go client (https://github.com/elastic/go-elasticsearch) for the ElasticSearch database (https://www.elastic.co/products/elasticsearch). esquery alleviates the need to use extremely nested maps (map[string]interface{}) and serializing queries to JSON manually. It also helps eliminating common mistakes such as misspelling query types, as everything is statically typed. Using `esquery` can make your code much easier to write, read and maintain, and significantly reduce the amount of code you write. esquery provides a method chaining-style API for building and executing queries and aggregations. It does not wrap the official Go client nor does it require you to change your existing code in order to integrate the library. Queries can be directly built with `esquery`, and executed by passing an `*elasticsearch.Client` instance (with optional search parameters). Results are returned as-is from the official client (e.g. `*esapi.Response` objects). Getting started is extremely simple: esquery currently supports version 7 of the ElasticSearch Go client. The library cannot currently generate "short queries". For example, whereas ElasticSearch can accept this: { "query": { "term": { "user": "Kimchy" } } } The library will always generate this: This is also true for queries such as "bool", where fields like "must" can either receive one query object, or an array of query objects. `esquery` will generate an array even if there's only one query object.
Package jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder with code generation and automatic query result data mapping. Jet currently supports PostgreSQL, MySQL, MariaDB and SQLite. Future releases will add support for additional databases. Use the command bellow to add jet as a dependency into go.mod project: Jet generator can be installed in one of the following ways: (Go1.16+) Install jet generator using go install: go install github.com/go-jet/jet/v2/cmd/jet@latest Install jet generator to GOPATH/bin folder: cd $GOPATH/src/ && GO111MODULE=off go get -u github.com/go-jet/jet/cmd/jet Install jet generator into specific folder: git clone https://github.com/go-jet/jet.git cd jet && go build -o dir_path ./cmd/jet Make sure that the destination folder is added to the PATH environment variable. Jet requires already defined database schema(with tables, enums etc), so that jet generator can generate SQL Builder and Model files. File generation is very fast, and can be added as every pre-build step. Sample command: Before we can write SQL queries in Go, we need to import generated SQL builder and model types: To write postgres SQL queries we import: Then we can write the SQL query: Now we can run the statement and store the result into desired destination: We can print a statement to see SQL query and arguments sent to postgres server: Output: If we print destination as json, we'll get: Detail info about all statements, features and use cases can be found at project wiki page - https://github.com/go-jet/jet/wiki.
Package dali wraps the sql.DB and provides convenient API for building database driven applications. Its main goal is to create a unified way of handling placeholders among all drivers and to simplify some common, repetive queries. There is no support for query builders (you have to write pure SQL queries). It focuses on the common queries (like writing INSERTs or UPDATEs) and on loading of results into structs, for which it provides easy-to-write alternatives. The following is the complete list of possible placeholders that can be used when writing a query using Query method. dali has also a support for prepared statements. However, it doesn't support certain placeholders. Only ?ident, ?ident..., and ?sql placeholders are allowed in the phase of the query building (befored the statement is prepared). The ? placeholder is the only one left for parameter binding. So working with prepared statements can look like this:
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
Package dotsql provides a way to separate your code from SQL queries. It is not an ORM, it is not a query builder. Dotsql is a library that helps you keep sql files in one place and use it with ease. For more usage examples see https://github.com/gchaincl/dotsql
Package sqlbuilder is a SQL-query builder for golang. This supports you using relational database with more readable and flexible code than raw SQL query string. See https://github.com/umisama/go-sqlbuilder for more infomation.
Go SQL, tool for decoding results into Go structs. Supports streaming. NOT AN ORM, and should be used instead of an ORM, in combination with a simple query builder (see below). See the sibling library "github.com/mitranim/sqlb": a simple query builder that supports converting structs into named arguments. • Decodes SQL records into Go structs. See `Query()`. • Supports nested records/structs. • Supports nilable nested records/structs in outer joins. • Supports streaming. See `QueryScanner()`. When decoding a row into a struct, Gos observes the following rules. 1. Columns are matched to public struct fields whose `db` tag exactly matches the column name. Private fields or fields without `db` are completely ignored. Example: 2. Fields of embedded structs are treated as part of the enclosing struct. For example, the following two definitions are completely equivalent. Same as: 3. Fields of nested non-embedded structs are matched with columns whose aliases look like `"outer_field.inner_field.innermost_field"` with arbitrary nesting. Example: 4. If every column from a nested struct is null or missing, the entire nested struct is considered null. If the field is not nilable (struct, not pointer to struct), this will produce an error. Otherwise, the field is left nil and not allocated. This convention is extremely useful for outer joins, where nested records are often null. Example: Gos is somewhat similar to https://github.com/jmoiron/sqlx. Key differences: • Supports null records in outer joins, as nested struct pointers. • Selects fields explicitly, by reflecting on the output struct. This allows YOU to write `select *`, but if the struct is lacking some of the fields, the DB will optimize them out of the query. • Simpler API, does not wrap `database/sql`. • Explicit field-column mapping, no hidden renaming. • Has only one tiny dependency (most deps in `go.mod` are test-only). • ... probably more Gos doesn't specially support SQL arrays. Generally speaking, SQL arrays are usable only for primitive types such as numbers or strings. Some databases, such as Postgres, have their own implementations of multi-dimensional arrays, which are non-standard and have so many quirks and limitations that it's more practical to just use JSON. Arrays of primitives are already supported in adapters such as "github.com/lib/pq", which are orthogonal to Gos and used in combination with it.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/kovetskiy/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
Package loukoum provides a simple SQL Query Builder. At the moment, only PostgreSQL is supported. If you have to generate complex queries, which rely on various contexts, loukoum is the right tool for you. It helps you generate SQL queries from composable parts. However, keep in mind it's not an ORM or a Mapper so you have to use a SQL connector (like "database/sql" or "sqlx", for example) to execute queries. If you're afraid to slip a tiny SQL injection manipulating fmt (or a byte buffer...) when you append conditions, loukoum is here to protect you against yourself. For further informations, you can read this documentation: https://github.com/DzananGanic/loukoum/blob/master/README.md Or you can discover loukoum with these examples. An "insert" can be generated like that: Also, if you need an upsert, you can define a "on conflict" clause: Updating a news is also simple: You can remove a specific user: Or select a list of users...
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. This example shows how to do CRUD operations. This example shows how to populate DB data in different ways. This example shows how to use query builder to build DB queries. This example shows how to use query builder in transactions.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
Package jet is a framework for writing type-safe SQL queries in Go, with ability to easily convert database query result into desired arbitrary object structure. Use the bellow command to install jet Install jet generator to GOPATH bin folder. This will allow generating jet files from the command line. *Make sure GOPATH bin folder is added to the PATH environment variable. Jet requires already defined database schema(with tables, enums etc), so that jet generator can generate SQL Builder and Model files. File generation is very fast, and can be added as every pre-build step. Sample command: Then next step is to import generated SQL Builder and Model files and write SQL queries in Go: To write SQL queries for PostgreSQL import: To write SQL queries for MySQL and MariaDB import: *Dot import is used so that Go code resemble as much as native SQL. Dot import is not mandatory. Write SQL: Store result into desired destination: Detail info about all features and use cases can be found at project wiki page - https://github.com/go-jet/jet/wiki.
Package gocqlx is an idiomatic extension to gocql that provides usability features. With gocqlx you can bind the query parameters from maps and structs, use named query parameters (:identifier) and scan the query results into structs and slices. It comes with a fluent and flexible CQL query builder and a database migrations module.
Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. This example shows how to do CRUD operations. This example shows how to populate DB data in different ways. This example shows how to use query builder to build DB queries. This example shows how to use query builder in transactions.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.