FluxaORM: A Golang ORM for MySQL and Redis
Guide
Plugins
GitHub
Guide
Plugins
GitHub
    • Introduction
    • Registry
    • Data pools
    • Entities
    • Entity fields
    • MySQL Indexes
    • Engine
    • ORM
    • Entity Schema
    • Schema Update
    • CRUD
    • Async flush
    • Searching for Entities
    • Redis Search Engine
    • MySQL Queries
    • Local Cache
    • Redis Operations
    • Distributed Lock
    • Queries Log
    • Plugins
    • Log tables

Registry

The orm.Registry object is the starting point for using FluxaORM. It allows you to configure your database connections and register structs that represent your data. You can initialize a orm.Registry object using the orm.NewRegistry() function, as shown in the following example:

package main

import "github.com/latolukasz/fluxaorm"

func main() {
    // Initialize a new Registry
    registry := fluxaorm.NewRegistry()
    
    // Register a MySQL connection pool
    registry.RegisterMySQL("user:password@tcp(localhost:3306)/db", fluxaorm.DefaultPoolCode, nil) 
} 

Alternatively, you can configure the orm.Registry object using data from a YAML file, as shown in the following example:

package main

import (
    "github.com/latolukasz/fluxaorm"
    "io/ioutil"
    "gopkg.in/yaml.v2"
)

func main() {
    data, err := ioutil.ReadFile("./config.yaml")
    if err != nil {
        panic(err)
    }
    var parsedYaml map[string]interface{}
    err = yaml.Unmarshal(yamlFileData, &parsedYaml)
    if err != nil {
        panic(err)
    }
    registry := fluxaorm.NewRegistry()
    err = registry.InitByYaml(parsedYaml)
     if err != nil {
        panic(err)
    }
}
default:
  mysql: 
    uri: user:password@tcp(localhost:3306)/db
Edit this page
Last Updated: 8/8/25, 9:02 PM
Prev
Introduction
Next
Data pools