sql

package
v4.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package sql is for a sql database model

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModel

func NewModel(opts ...model.Option) model.Model

Types

type DB

type DB struct {
	*gorm.DB
}

The sql DB

func NewDB

func NewDB(name, addr string) (*DB, error)

NewDB provides a new database connection. If [name].db.address is found in the config then it's used as the address, otherwise we use sqlite.

func (*DB) Create

func (d *DB) Create(v interface{}) error

func (*DB) Delete

func (d *DB) Delete(v interface{}) error

func (*DB) Query

func (d *DB) Query(res interface{}, where ...interface{}) error

func (*DB) Read

func (d *DB) Read(v interface{}) error

func (*DB) Register

func (d *DB) Register(v interface{}) error

func (*DB) Update

func (d *DB) Update(v interface{}) error

Jump to

Keyboard shortcuts

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