dbdoc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// %s分别是多个子图,边样式和边
	GraphFormat = `` /* 209-byte string literal not displayed */

	EdgeStyleFormat = `edge [ arrowtail=normal, style=dashed, color="#444444" ]
	`
)

dot脚本

Functions

func Resolve

func Resolve(w io.Writer, v ...interface{}) error

Resolve 解析多个结构体,并将它们写到w

func ResolveGraph

func ResolveGraph(w io.Writer, v ...interface{}) error

ResolveGraph 解析多个结构体,生成图脚本,并将它们写到w

Types

type Field

type Field struct {
	Name        string // 名字
	Type        string // 类型
	Nullable    bool   // 是否可null
	Primary     bool   // 是否主键
	Description string // 描述
	Index              // 索引
	Relation           // 关系
}

Field 字段

func FieldByTag

func FieldByTag(tag reflect.StructTag) Field

FieldByTag 从tag解析field

type Index

type Index struct {
	Name      string  // 名字
	Unique    bool    // 是否唯一索引
	FieldList []Field // 涉及字段
}

Index 索引

type Mapper

type Mapper func(string) string

Mapper 映射函数类型

type Relation

type Relation struct {
	TableName  string // 表名字
	TableField string // 表字段
}

Relation 关系

type Table

type Table struct {
	Name        string  // 名字
	Comment     string  // 注释
	Description string  // 描述
	FieldList   []Field // 字段列表
	IndexList   []Index // 索引列表

	//  er图
	Subgraph string // 子图
	Edge     string // 边
	// contains filtered or unexported fields
}

Table 表

func NewTable

func NewTable() *Table

NewTable 新建表

func (*Table) MakeGraph

func (t *Table) MakeGraph() *Table

MakeGraph 生成图

func (*Table) New

func (t *Table) New() *Table

New 新建

func (*Table) Resolve

func (t *Table) Resolve(v interface{}) *Table

Resolve 解析

func (*Table) SetComment

func (t *Table) SetComment(comment string) *Table

SetComment 设置注释

func (*Table) SetDescription

func (t *Table) SetDescription(description string) *Table

SetDescription 设置描述

func (*Table) SetMapper

func (t *Table) SetMapper(f Mapper) *Table

SetMapper 设置字段名映射方法

func (*Table) SetTypeMapper

func (t *Table) SetTypeMapper(f Mapper) *Table

SetTypeMapper 设置类型映射方法

func (*Table) Write

func (t *Table) Write(w io.Writer) *Table

Write 写入f

Jump to

Keyboard shortcuts

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