database

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQL      string = "mysql"
	PostgreSQL string = "postgres"
	SQLite     string = "sqlite"
)

Variables

This section is empty.

Functions

func Get

func Get(name string) *gorm.DB

func New

func New(databases *Databases) error

Types

type Database

type Database struct {
	Protocol string `yaml:"protocol"` // 'mysql', 'postgres', 'sqlite'
	Host     string `yaml:"host"`     // 'localhost', '127.0.0.1', ou vide pour SQLite
	Port     string `yaml:"port"`     // '3306', '5432', ou vide pour SQLite
	User     string `yaml:"user"`     // Nom d'utilisateur, vide pour SQLite
	Password string `yaml:"password"` // Mot de passe, vide pour SQLite
	DBname   string `yaml:"dbname"`   // Nom de la base de données, chemin vers le fichier SQLite ou ':memory:'

	// Paramètres spécifiques pour la connexion à la base de données
	// Par exemple, pour MySQL & PostgreSQL, ça pourrait être 'sslmode=disable', etc.
	Options Options
}

func (*Database) ToDSN

func (cfg *Database) ToDSN() (string, error)

func (*Database) Validate

func (cfg *Database) Validate() error

type Databases

type Databases map[string]*Database

type Options

type Options map[string]string

Jump to

Keyboard shortcuts

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