db

package module
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	// Init initializes the db connection
	Init(opts Options) error
	// Options Returns the db options
	Options() Options
	// Address Returns the db bind interface
	Address() string
	// Connect connects to the db
	Connect(handlers ...Handler) error
	// Disconnect disconnects from the db
	Disconnect(handlers ...Handler) error
	// Handle returns the raw connection handle to the db
	Handle() interface{}
}

Database defines the interface for connection with database

type Handler

type Handler func(Database) error

Handler is used to run a function on db events

type Model

type Model interface {
	// CreateIndexes creates the required indexes
	CreateIndexes(db Database) error
	// PrintIndexes prints the indexes of the model
	PrintIndexes(db Database)
}

Model defines the interface for a model that can saved in a db

type Options

type Options struct {
	Name     string
	Address  string
	Database string
	Username string
	Password string
}

Options is the config for the db

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL