er

package
v2.23.13 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ERCol

type ERCol struct {
	Name     string            `json:"name"`
	DataType string            `json:"dataType"`
	Enum     map[string]EREnum `json:"enum"`
	Summary  string            `json:"summary"`
	Desc     string            `json:"desc"`
	Rel      []string          `json:"rel"`
}

type ERDatabase

type ERDatabase struct {
	Name   string              `json:"name"`
	Tables map[string]*ERTable `json:"tables"`
}

func DatabaseERFromDB

func DatabaseERFromDB(database *sqlx.Database, dialect builder.Dialect) *ERDatabase
Example
package main

import (
	"encoding/json"

	"github.com/go-courier/sqlx/v2/er"
	"github.com/go-courier/sqlx/v2/generator/__examples__/database"
	"github.com/go-courier/sqlx/v2/postgresqlconnector"
)

func main() {
	ers := er.DatabaseERFromDB(database.DBTest, &postgresqlconnector.PostgreSQLConnector{})
	_, _ = json.MarshalIndent(ers, "", "  ")
}
Output:

type EREnum added in v2.4.0

type EREnum struct {
	Value int    `json:"value"`
	Name  string `json:"name"`
	Label string `json:"label"`
}

type ERKey

type ERKey struct {
	Name      string   `json:"name"`
	Method    string   `json:"method"`
	IsUnique  bool     `json:"isUnique"`
	IsPrimary bool     `json:"isPrimary"`
	Cols      []string `json:"cols"`
}

type ERTable

type ERTable struct {
	Name    string            `json:"name"`
	Summary string            `json:"summary"`
	Desc    string            `json:"desc"`
	Cols    map[string]*ERCol `json:"cols"`
	Keys    map[string]*ERKey `json:"keys"`
}

Jump to

Keyboard shortcuts

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