sql

package module
v0.0.0-...-6c0649a Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Silent logger.LogLevel = iota
	Error
	Warn
	Info
)

LogLevels ...

Variables

This section is empty.

Functions

func Conn

func Conn() *gorm.DB

Conn returns the database connection

func Count

func Count[T any](query *T) (int64, error)

Count ...

func Create

func Create[T any](data *T) error

Create ...

func Delete

func Delete[T any](query *T) error

Delete ...

func FindAll

func FindAll[T any](query *T) ([]*T, error)

FindAll ...

func FindOne

func FindOne[T any](query *T) (*T, error)

FindOne ...

func FindWithLimit

func FindWithLimit[T any](query *T, limit int) ([]*T, error)

FindWithLimit ...

func Init

func Init(dbType Platform, dsn string, logLevel logger.LogLevel) error

Init initializes the database connection with GORM

func Update

func Update[T any](data *T) error

Update ...

Types

type Platform

type Platform string

Platform ...

const (
	Postgres Platform = "postgres"
	MySQL    Platform = "mysql"
	Sqlite   Platform = "sqlite"
)

Platforms ...

Jump to

Keyboard shortcuts

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