gen_mgr

package
v0.0.0-...-62aa942 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FM = template.FuncMap{
	"myOps":                    MyFieldOps,
	"opsString":                OpsString,
	"PaseRestNodeOrderOp":      PaseRestNodeOrderOp,
	"PaseRestFieldQueryOp":     PaseRestFieldQueryOp,
	"PaseRestFieldOperability": PaseRestFieldOperability,
	"PaseRestNodePaging":       PaseRestNodePaging,
	"PaseRestNodeMethod":       PaseRestNodeMethod,
	"CheckMethodHasSwitch":     CheckMethodHasSwitch,
	"PaseRestEdgeMethod":       PaseRestEdgeMethod,
	"PaseFieldIsEnum":          PaseFieldIsEnum,
	"PaseRestEdgeInclude":      PaseRestEdgeInclude,
	"PaseGraphInclude":         PaseGraphInclude,
	"IncludesTo":               IncludesTo,
	"PaseRelType":              PaseRelType,
	"SliceHasKey":              SliceHasKey,
	"PaseFieldsOrderOp":        PaseFieldsOrderOp,
	"Join":                     strings.Join,
	"ForMat":                   GenForMat,
	"FuncImportUnique":         FuncImportUnique,
	"MergeImports":             MergeImports,
	"Dump":                     Dump,
	"PathJoin":                 path.Join,
}
View Source
var RestEdgeType = "RestEdgeOp"
View Source
var RestFieldType = "RestFieldOp"
View Source
var RestNodeType = "RestNodeOp"

Functions

func CheckMethodHasSwitch

func CheckMethodHasSwitch(s GenRestSwitch) bool

func DepthGen

func DepthGen(src, dest string, fn func(src, dest string))

func Dump

func Dump(i interface{}) string

func FuncImportUnique

func FuncImportUnique(fs []gen_apiV2.Func) string

func GenApi

func GenApi(src, dest string)

func GenForMat

func GenForMat(s string, data interface{}) string

func GenTs

func GenTs(src, dest, prefix string)

func GetInclude

func GetInclude(m map[string]map[string]interface{}, node string, l []string, res *[][]string)

func GetModuleName

func GetModuleName() string

func IncludesTo

func IncludesTo(include []string, symbol string) string

func LoadV2

func LoadV2(schemaPath string, dest string)

func MergeImports

func MergeImports(fs []gen_apiV2.Func) string

func OpsString

func OpsString(ops []Op) []string

func PaseGraphInclude

func PaseGraphInclude(g gen.Graph) map[string][]string

func PaseRelType

func PaseRelType(e *gen.Edge) struct {
	Src  string
	Dest string
}

func PaseRestEdgeInclude

func PaseRestEdgeInclude(m map[string]interface{}) bool

func PaseRestFieldOperability

func PaseRestFieldOperability(m map[string]interface{}, o string) string

func PaseRestFieldQueryOp

func PaseRestFieldQueryOp(m map[string]interface{}) []string

func SliceContains

func SliceContains(l []string, s string) bool

func SliceHasKey

func SliceHasKey(l []string, k string) bool

func Snake

func Snake(s string) string

Types

type EdgeMethod

type EdgeMethod struct {
	Get    EdgeMethodOp
	Create EdgeMethodOp
	Delete EdgeMethodOp
}

func PaseRestEdgeMethod

func PaseRestEdgeMethod(m map[string]interface{}) EdgeMethod

type EdgeMethodOp

type EdgeMethodOp struct {
	Has       GenRestSwitch `json:"has"`
	RouterTag string        `json:"router_tag"`
	Comments  []string      `json:"comments"`
}

type EnumData

type EnumData struct {
	Has    bool
	Values string
}

func PaseFieldIsEnum

func PaseFieldIsEnum(f *gen.Field) EnumData

type FieldOperability

type FieldOperability struct {
	Selete GenRestSwitch
	Create GenRestSwitch
	Update GenRestSwitch
}

type FieldQueryable

type FieldQueryable struct {
	EQ           GenRestSwitch `json:"EQ"`
	NEQ          GenRestSwitch `json:"NEQ"`
	GT           GenRestSwitch `json:"GT"`
	GTE          GenRestSwitch `json:"GTE"`
	LT           GenRestSwitch `json:"LT"`
	LTE          GenRestSwitch `json:"LTE"`
	IsNil        GenRestSwitch `json:"IsNil"`
	NotNil       GenRestSwitch `json:"NotNil"`
	EqualFold    GenRestSwitch `json:"EqualFold"`
	Contains     GenRestSwitch `json:"Contains"`
	ContainsFold GenRestSwitch `json:"ContainsFold"`
	HasPrefix    GenRestSwitch `json:"HasPrefix"`
	HasSuffix    GenRestSwitch `json:"HasSuffix"`
	In           GenRestSwitch `json:"In"`
	NotIn        GenRestSwitch `json:"NotIn"`
	Order        GenRestSwitch `json:"Order"`
}

type GPackingV2

type GPackingV2 struct {
	gen.Graph
	PkgName  string
	Includes map[string][]string
}

type GenRestSwitch

type GenRestSwitch int
const GenRestDefault GenRestSwitch = 0
const GenRestFalse GenRestSwitch = 2
const GenRestTrue GenRestSwitch = 1

type GoMod

type GoMod struct {
	Module Module
}

type Module

type Module struct {
	Path    string
	Version string
}

type NodeMethod

type NodeMethod struct {
	GetOne     NodeMethodOp
	GetList    NodeMethodOp
	CreateOne  NodeMethodOp
	CreateList NodeMethodOp
	UpdateOne  NodeMethodOp
	UpdateList NodeMethodOp
	DeleteOne  NodeMethodOp
	DeleteList NodeMethodOp
}

func PaseRestNodeMethod

func PaseRestNodeMethod(m map[string]interface{}) NodeMethod

type NodeMethodOp

type NodeMethodOp struct {
	Has       GenRestSwitch `json:"has"`
	RouterTag string        `json:"router_tag"`
	Comments  []string      `json:"comments"`
}

type Op

type Op int
const (
	EQ           Op = iota // =
	NEQ                    // <>
	GT                     // >
	GTE                    // >=
	LT                     // <
	LTE                    // <=
	IsNil                  // IS NULL / has
	NotNil                 // IS NOT NULL / hasNot
	In                     // within
	NotIn                  // without
	EqualFold              // equals case-insensitive
	Contains               // containing
	ContainsFold           // containing case-insensitive
	HasPrefix              // startingWith
	HasSuffix              // endingWith
)

func MyFieldOps

func MyFieldOps(f *gen.Field) (ops []Op)

type Order

type Order struct {
	DefaultAcsOrder   []string `json:"default_acs_order"`
	DefaultDescOrder  []string `json:"default_desc_order"`
	OpenOptionalOrder bool     `json:"open_optional_order"`
	OptionalOrder     []string `json:"optional_order"`
}

func PaseRestNodeOrderOp

func PaseRestNodeOrderOp(m map[string]interface{}) Order

type OrderOp

type OrderOp struct {
	OrderField []string
	Has        bool
}

func PaseFieldsOrderOp

func PaseFieldsOrderOp(fs []*gen.Field) OrderOp

type Paging

type Paging struct {
	Open     bool    `json:"open"`
	Must     bool    `json:"must"`
	MaxLimit float64 `json:"max_limit"`
}

func PaseRestNodePaging

func PaseRestNodePaging(m map[string]interface{}) Paging

type RestEdgeOp

type RestEdgeOp struct {
	Method  EdgeMethod
	Include GenRestSwitch
}

type RestFieldOp

type RestFieldOp struct {
	FieldQueryable   FieldQueryable   `json:"field_queryable"`
	FieldOperability FieldOperability `json:"field_operability"`
}

func (RestFieldOp) Name

func (r RestFieldOp) Name() string

type RestNodeOp

type RestNodeOp struct {
	Paging Paging     `json:"paging"`
	Order  Order      `json:"order"`
	Method NodeMethod `json:"method"`
}

func (RestNodeOp) Name

func (r RestNodeOp) Name() string

type TempString

type TempString string

func (TempString) Format

func (s TempString) Format(data interface{}) (out string, err error)

Jump to

Keyboard shortcuts

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