db

package
v0.0.0-...-6dfea25 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package db provide useful functions to create mysql instance.

Index

Constants

View Source
const DefaultLimit = 1000

Package gormutil is a util to convert offset and limit to default values.

Variables

This section is empty.

Functions

func New

func New(opts *Options) (*gorm.DB, error)

New create a new gorm db instance with the given options.

Types

type LimitAndOffset

type LimitAndOffset struct {
	Offset int
	Limit  int
}

LimitAndOffset contains offset and limit fields.

func Unpointer

func Unpointer(offset *int64, limit *int64) *LimitAndOffset

Unpointer fill LimitAndOffset with default values if offset/limit is nil or it will be filled with the passed value.

type Options

type Options struct {
	Host                  string
	Username              string
	Password              string
	Database              string
	MaxIdleConnections    int
	MaxOpenConnections    int
	MaxConnectionLifeTime time.Duration
	LogLevel              int
	Logger                logger.Interface
}

Options defines optsions for mysql database.

Jump to

Keyboard shortcuts

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