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 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 sqldimel provides a SQL DML query builder. Package sqldimel provides a SQL DML query builder.
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.
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/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 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 pqcomp provides dead simple query builder that support null types from sql package, but also provide interface Appearer. To be comprehensive solution, query builder needs to be optimized. Some of the benchmark results:
goqu an idiomatch SQL builder, and query package. Please see https://github.com/doug-martin/goqu for an introduction to goqu.
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/doug-martin/goqu for an introduction to goqu.
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 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 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 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/GlebBeloded/goqu for an introduction to goqu.
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/lordofbuckwheat/goqu for an introduction to goqu.
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 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.
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 sqlz (pronounced "sequelize") is an un-opinionated, un-obtrusive SQL query builder for Go projects, based on github.com/jmoiron/sqlx. As opposed to other query builders, sqlz does not mean to bridge the gap between different SQL servers and implementations by providing a unified interface. Instead, it aims to support an extended SQL syntax that may be implementation-specific. For example, if you wish to use PostgreSQL-specific features such as JSON operators and upsert statements, sqlz means to support these without caring if the underlying database backend really is PostgreSQL. In other words, sqlz builds whatever queries you want it to build. sqlz is easy to integrate into existing code, as it does not require you to create your database connections through the sqlz API; in fact, it doesn't supply one. You can either use your existing `*sql.DB` connection or an `*sqlx.DB` connection, so you can start writing new queries with sqlz without having to modify any existing code. sqlz leverages sqlx for easy loading of query results. Please make sure you are familiar with how sqlx works in order to understand how row scanning is performed. You may need to add `db` struct tags to your Go structures. sqlz provides a comfortable API for running queries in a transaction, and will automatically commit or rollback the transaction as necessary.
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 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 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
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 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.
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 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 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 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 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.
Package goq provides a type-safe and fluent query builder. You can construct various queries using Goq. All expression structs and interfaces are named as 'XxxExpr' and the Column struct implements basic operators like 'Add', 'Like', 'Between', etc. See the Expr interface for the documentation about these operators. A collector collects *sql.Rows fetched from DB into a common data structure like a slice, map, etc. Available collectors: These collector methods can be used from the query builder. 'Table' in the above list means a table helper (see [TODO: link] for custom query builder). For example, the following code collects users table records into a 'users' slice and other values into another slice. The collectors defined in a table helper are called model collector. They collect rows into a model or models. The model collector structs are named 'ModelXxxCollector'. For example, 'Table.ToSlice' returns a ModelSliceCollector. The collectors defined in a query builder are called generic collector. They collect rows into a generic structure such as a slice of non-model struct. The generic collector structs are named 'XxxCollector'. For example, 'ToSlice' returns a SliceCollector. Furthermore, collectors are classified into two types: list collector or single collector. A list collector collects rows into a slice or a map of slices. A single collector collects a first row only into a struct or map. You need to pass them to Collect and First methods, respectively. Note that we often use 'z' as a variable name of Goq query builder in example code. This name has no special meanings. We use it just because this character rarely duplicates with other common variable names and is easy to identify.
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 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