objectdb

package module
v0.0.122 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 13 Imported by: 2

README

objectdb

Operaciones CRUD de Objetos en Base de Datos..

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	*sql.DB
	*unixid.UnixID
	// contains filtered or unexported fields

} // DataBase Engine Adapter

func Get

func Get(dba databaseAdapter) *Connection

obtener conexión

func (Connection) BackupDataBase added in v0.0.80

func (c Connection) BackupDataBase(callback func(err string))

func (Connection) ClearAllTableDataInDB added in v0.0.89

func (c Connection) ClearAllTableDataInDB(tables ...string) (err string)

func (Connection) CreateObjectsInDB added in v0.0.27

func (c Connection) CreateObjectsInDB(table_name string, backup_required bool, items any) (err string)

support: []map[string]string or map[string]string

func (*Connection) CreateTablesInDB added in v0.0.35

func (c *Connection) CreateTablesInDB(tables []*model.Object, result func(err string))

func (Connection) DeleteObjectsInDB added in v0.0.27

func (c Connection) DeleteObjectsInDB(table_name string, backup_required bool, all_data ...map[string]string) (err string)

DeleteObjectsInDB borra objetos de la base de datos según nombre de la tabla y ids.

func (Connection) Exists

func (c Connection) Exists(textResponse, objectSelect, sql string) (ok bool)

Exists verifica si existe un que es y algo en la base de datos según sql ej: "la base de datos","tiendadb","sql para la consulta"

func (*Connection) Open

func (c *Connection) Open() *sql.DB

func (Connection) QueryAll

func (c Connection) QueryAll(sql string, args ...interface{}) (out []map[string]string, err string)

QueryAll .

func (Connection) QueryOne

func (c Connection) QueryOne(sql string, args ...interface{}) (out map[string]string, err string)

QueryOne . https://my.oschina.net/nowayout/blog/139398

func (Connection) QueryWithoutANSWER

func (c Connection) QueryWithoutANSWER(sql string) (err string)

QueryWithoutANSWER SinResultado ejecuta sql en bd con sin respuesta de mas de 1 operación recibe sql y mensaje a mostrar en consola

func (Connection) ReadDataDB added in v0.0.122

func (c Connection) ReadDataDB(p struct {
	FROM_TABLE    string              //ej: "users,products" or: public.reservation, public.patient"
	SELECT        string              // "name, phone, address" default *
	WHERE         []map[string]string //ej: "patient.id_patient=reservation.id_patient, (OR) reservation.id_staff = '2'"
	AND_CONDITION bool                // OR default se agrega AND si es true
	ID            string              // unique search (usado en indexdb)
	ORDER_BY      string              // name,phone,address
	SORT_DESC     bool                //default ASC
	LIMIT         int                 // 10, 5, 100. note: Postgres y MySQL: "LIMIT 10", SQLite: "LIMIT 10 OFFSET 0" OR "" no limit
	RETURN_ANY    bool                // default string return []map[string]string, any = []map[string]interface{}
}, async_results func(r struct {
	String []map[string]string
	Any    []map[string]any
}, err string)) (sync_results []map[string]string, err string)

func (Connection) RunDBOnClient added in v0.0.122

func (Connection) RunDBOnClient() bool

func (Connection) SelectValue

func (c Connection) SelectValue(sql string) (out string, ok bool)

SelectValue retorna valor de una consulta sql

func (*Connection) Set

func (c *Connection) Set(dba databaseAdapter)

setear conexión base de datos cerrar después de usar

func (*Connection) TableExist added in v0.0.35

func (c *Connection) TableExist(table_name string) (exist bool, err string)

func (*Connection) TestCrudStart

func (c *Connection) TestCrudStart(t *testing.T)

func (Connection) UpdateObjectsInDB added in v0.0.27

func (c Connection) UpdateObjectsInDB(table_name string, backup_required bool, all_data ...map[string]string) (err string)

UpdateObjectsInDB

Jump to

Keyboard shortcuts

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