db

package
v0.0.0-...-ce87471 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Copyright 2024 Aleksei Grigorev https://aleksvgrig.com, https://github.com/AlekseiGrigorev, aleksvgrig@gmail.com. Package define interfaces, structures and functions for working with mysql database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	// contains filtered or unexported fields
}

Db define database config and connection

func (*Db) Init

func (dbIn *Db) Init(user string, passwd string, addr string, port int, dbName string)

Init database connection

func (*Db) Query

func (dbIn *Db) Query(sql string, params []any, model RowModel) ([]RowModel, error)

Query query rows data from database Returns slice of RowModels

func (*Db) QueryRow

func (dbIn *Db) QueryRow(sql string, params []any, model RowModel) (RowModel, error)

QueryRow query one row data from database Returns RowModel

type RowModel

type RowModel interface {
	GetNewModel() RowModel
	GetColumnPointers() []interface{}
}

RowModel define interface for model, created from on row of selected data

Jump to

Keyboard shortcuts

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