db

package
v0.0.0-...-916c69f Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

*FileHeader

  • @Author: Liangkang Zhang
  • @Date: 2026/1/25 11:48:52
  • @LastEditors: Liangkang Zhang
  • @LastEditTime: 2026/1/25 11:49:39
  • @Description:
  • @Copyright: Copyright (©)}) 2026 Liangkang Zhang<lkzhang98@gmail.com>. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.. All rights reserved.
  • @Email: lkzhang98@gmail.com
  • @Repository: https://github.com/geminik12/autostack

*FileHeader

  • @Author: Liangkang Zhang
  • @Date: 2026/1/25 11:52:22
  • @LastEditors: Liangkang Zhang
  • @LastEditTime: 2026/1/26 00:25:02
  • @Description:
  • @Copyright: Copyright (©)}) 2026 Liangkang Zhang<lkzhang98@gmail.com>. All rights reserved. Use of this source code is governed by a MIT style license that can be found in the LICENSE file.. All rights reserved.
  • @Email: lkzhang98@gmail.com
  • @Repository: https://github.com/geminik12/autostack

Index

Constants

This section is empty.

Variables

ProviderSet is db providers.

Functions

func MustRawDB

func MustRawDB(db *gorm.DB) *sql.DB

func NewMySQL

func NewMySQL(opts *MySQLOptions) (*gorm.DB, error)

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

func NewRedis

func NewRedis(opts *RedisOptions) (*redis.Client, error)

NewRedis create a new redis db instance with the given options.

Types

type MySQLOptions

type MySQLOptions struct {
	Addr                  string
	Username              string
	Password              string
	Database              string
	MaxIdleConnections    int
	MaxOpenConnections    int
	MaxConnectionLifeTime time.Duration
	// +optional
	Logger logger.Interface
}

MySQLOptions defines options for mysql database.

func (*MySQLOptions) DSN

func (o *MySQLOptions) DSN() string

DSN return DSN from MySQLOptions.

type RedisOptions

type RedisOptions struct {
	Addr         string
	Username     string
	Password     string
	Database     int
	MaxRetries   int
	MinIdleConns int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	PoolTimeout  time.Duration
	PoolSize     int
}

RedisOptions defines options for redis database.

Jump to

Keyboard shortcuts

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