dbutils

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_WHERE = "TRUE"
	DEFAULT_ORDER = "ID ASC"
)

Variables

This section is empty.

Functions

func ConnectAndWriteDBTest

func ConnectAndWriteDBTest(t *testing.T, dbc DBClient)

func Create

func Create[T any](c DBClient, objs []T)

func CreateOrOverwrite

func CreateOrOverwrite[T any](c DBClient, objs []T)

func DeleteAll

func DeleteAll(c DBClient, obj interface{})

func Migrate

func Migrate(c DBClient, obj interface{})

func Query

func Query[T any](query *gorm.DB) []T

func SelectAll

func SelectAll[T any](c DBClient) []T

Types

type DBClient

type DBClient interface {
	Connect(*gorm.Config)
	DB() *gorm.DB
	RegisterFlags(cmd *cobra.Command)
}

type TestData

type TestData struct {
	gorm.Model

	IntData    int
	StringData string
	BoolData   bool
}

func (*TestData) Compare

func (td *TestData) Compare(comp *TestData) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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