Categorygithub.com/frazercomputing/upper-io-db
modulepackage
1.0.1
Repository: https://github.com/frazercomputing/upper-io-db.git
Documentation: pkg.go.dev

# README

upper.io/db.v1

Build Status

The db package

Upper.io

upper.io/db.v1 is a Go package that allows developers to communicate with different databases through the use of adapters that wrap well-supported database drivers.

go get -u upper.io/db.v1

Is db an ORM?

db is not an ORM in the sense that it does not tell you how to design your software or how to validate your data, instead it only focuses on being a tool that deals with common operations on different databases:

// This code works the same for all supported databases.
var people []Person

res = col.Find(db.Cond{"name": "Max"}).Limit(10).Sort("-last_name")

err = res.All(&people)

In strict sense upper.io/db.v1 could be considered a non-opinionated ORM that rather stays out of the way.

Supported databases

Adapters

upper.io/db.v1 attempts to provide full compatiblity for CRUD operations across adapters. Some other operations (such transactions) are supported only on specific database adapters, such as MySQL, PostgreSQL and SQLite.

User documentation

See the project page, recipes and user documentation at upper.io/db.v1.

License

This project is licensed under the terms of the MIT License.

Copyright (c) 2012-2016 The upper.io/db.v1 authors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Authors

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Host converts the given name into a host structure.
HostPort converts the given name and port into a host structure.
Open configures a database session using the given adapter's name and the provided settings.
ParseAddress parses s into a host or socket structures.
Register associates an adapter's name with a type.
Socket converts the given name into a socket structure.

# Constants

EnvEnableDebug may be used by adapters to determine if the user has enabled debugging.

# Variables

Shared error messages.
Deprecated but kept for backwards compatibility.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.
Shared error messages.

# Structs

Func is a struct that represents database functions.
HostAddr is the name or IP of a server coupled with an optional port number.
Raw holds chunks of data to be passed to the database without any filtering.
Settings holds database connection and authentication data.
SocketAddr is a UNIX address.

# Interfaces

Address is an interface that represents the host part of an URL.
Collection is an interface that defines methods for handling data sources or tables.
ConnectionURL is the interface that defines methods for connection strings.
Constrainer is the interface implemented by structs that can delimit themselves.
Database is an interface that defines methods that must be provided by database adapters.
IDSetter is the interface implemented by structs that can set their own ID after calling Append().
Int64IDSetter implements a common pattern for setting int64 IDs.
Marshaler is the interface implemented by structs that can marshal themselves into data suitable for storage.
Result is an interface that defines methods for working with result sets.
Tx is an interface that provides the same methods that the `db.Database` does, plus some other that help the user deal with database transactions.
Uint64IDSetter implements a common pattern for setting uint64 IDs.
Unmarshaler is the interface implemented by structs that can transform themselves from storage data into a valid value.

# Type aliases

And is an array of interfaces that is used to join two or more expressions under logical conjunction, it accepts `db.Cond{}`, `db.Or{}`, `db.Raw{}` and other `db.And{}` values.
Cond is a map used to define conditions passed to `db.Collection.Find()` and `db.Result.Where()`.
Or is an array of interfaced that is used to join two or more expressions under logical disjunction, it accepts `db.Cond{}`, `db.And{}`, `db.Raw{}` and other `db.Or{}` values.