qbun

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 7 Imported by: 0

README

#qbun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckColumnType

func CheckColumnType(ctx context.Context, tx bun.Tx, model interface{}, column string) (string, error)

CheckColumnType returns the type of the column.

func DeleteUnusedRows

func DeleteUnusedRows(ctx context.Context, tx bun.Tx, model interface{}, fkTable, fkColumn, column string) error

DeleteUnusedRows remove rows from table (model) if any value of this table's column is not contained in other table's (fkTable) column (fkColumn).

func Init added in v0.0.2

func Init(dataBase *bun.DB)

func InsertRowsIfNotExist

func InsertRowsIfNotExist(ctx context.Context, tx bun.Tx, model interface{}, columns []string) error

func RunInTx

func RunInTx(ctx context.Context, fs ...txFunc) error

Types

type ModelSelector

type ModelSelector interface {
	Select(ctx context.Context, tx bun.Tx) error
}

type TableData

type TableData struct {
	Column string
	Key    interface{}
	Value  interface{}
}

func (*TableData) UpdateCell

func (td *TableData) UpdateCell(ctx context.Context, db *bun.DB, model interface{}, pkColumn string, returnedModel ModelSelector) error

UpdateCell set value of TableData.Column to TableData.Value where value of column TableData.Key is equal to pkColumn.

type TableDataArray

type TableDataArray []*TableData

type UID

type UID struct {
	Update TableDataArray
	Insert TableDataArray
	Delete []string
}

Jump to

Keyboard shortcuts

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