gen

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeGormModel - type gorm model gen
	TypeGormModel = "gorm_model"
	// TypeBeegoModel - type beego model gen
	TypeBeegoModel = "beego_model"
)

Variables

This section is empty.

Functions

func Register

func Register(name string, adapter Instance)

Register makes a Generator adapter available by the adapter name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Config

type Config struct {
	Package      string `json:"package"`
	GenPath      string `json:"gen_path"`
	AllInOne     bool   `json:"all_in_one"`
	Items        []Item `json:"items"`
	MaxIdleConns int64  `json:"max_idle_conns"`
	MaxOpenConns int64  `json:"set_max_open_conns"`
}

Config - init config

type Generator

type Generator interface {
	// Gen - gen file
	Gen() error

	// start gc routine based on config settings.
	StartAndGC(config Config) error
}

Generator interface contains all behaviors for model generator adapter.

func NewGenerator

func NewGenerator(adapterName string, config Config) (adapter Generator, err error)

NewGenerator Create a new Generator driver by adapter name and config setting. it will start gc automatically.

type Instance

type Instance func() Generator

Instance is a function create a new Generator Instance

type Item

type Item struct {
	Name   string `json:"name"`
	Detail string `json:"detail"`
}

Item - gen item

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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