share

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const BUILDIN = false

BUILDIN 打包应用合成一个制品

View Source
const BUILDNAME = "yao"

BUILDNAME 制品名称

View Source
const PRVERSION = "DEV"

PRVERSION PreRelease Version

View Source
const VERSION = "0.10.3"

VERSION 版本号

Variables

View Source
var Libs = map[string]map[string]interface{}{}

Libs 共享库

Functions

func DBClose added in v0.10.3

func DBClose() error

DBClose close the database connections

func DBConnect

func DBConnect(dbconfig config.Database) (err error)

DBConnect 建立数据库连接

func DirAbs

func DirAbs(dir string) string

DirAbs 文件绝对路径

func DirNotExists

func DirNotExists(dir string) bool

DirNotExists 校验目录是否存在

func File added in v0.10.3

func File(id string, ext string) string

File ID to file

func GetAppFileBaseName

func GetAppFileBaseName(root string, file string) string

GetAppFileBaseName 读取文件base

func GetAppFileName

func GetAppFileName(root string, file string) string

GetAppFileName 读取文件

func GetAppPluginFileName

func GetAppPluginFileName(root string, file string) string

GetAppPluginFileName 读取文件

func GetDefaultColumns

func GetDefaultColumns(name string) map[string]Column

GetDefaultColumns 读取数据模型字段的呈现方式

func GetDefaultFilters

func GetDefaultFilters(name string) map[string]Filter

GetDefaultFilters 读取数据模型索引字段的过滤器

func GetFileBaseName

func GetFileBaseName(root string, file string) string

GetFileBaseName 读取文件base

func GetFileName

func GetFileName(root string, file string) string

GetFileName 读取文件

func GetQueryParam

func GetQueryParam(v interface{}, sid string) types.QueryParam

GetQueryParam 解析参数

func GetTypeName

func GetTypeName(path string) (name string, typ string)

GetTypeName 读取类型

func ID added in v0.10.2

func ID(root string, file string) string

ID parse unique name root: "/tests/apis" file: "/tests/apis/foo/bar.http.json"

func ImportJSON

func ImportJSON(name string, in []interface{}, v interface{}) error

ImportJSON 导入

func Load

func Load(cfg config.Config) error

Load 加载共享库

func LoadBuildIn

func LoadBuildIn(dir string) error

LoadBuildIn 从制品中读取

func LoadFrom

func LoadFrom(dir string) error

LoadFrom 从特定目录加载共享库

func ReadFile

func ReadFile(filename string) []byte

ReadFile 读取文件

func ScriptName

func ScriptName(filename string) string

ScriptName 解析数据处理脚本名称

func SessionFile added in v0.9.2

func SessionFile() error

SessionFile Start session file

func SessionRedis added in v0.9.2

func SessionRedis() error

SessionRedis Connect redis server

func SessionStart added in v0.9.2

func SessionStart() error

SessionStart start session

func SessionStop added in v0.9.2

func SessionStop()

SessionStop stop session

func SpecName

func SpecName(root string, file string) string

SpecName 解析名称 root: "/tests/apis" file: "/tests/apis/foo/bar.http.json"

func Walk

func Walk(root string, typeName string, cb func(root, filename string)) error

Walk 遍历应用目录,读取文件列表

func Watch

func Watch(root string, cb func(op string, file string))

Watch 监听目录

Types

type API

type API struct {
	Name    string        `json:"-"`
	Source  string        `json:"-"`
	Disable bool          `json:"disable,omitempty"`
	Process string        `json:"process,omitempty"`
	Guard   string        `json:"guard,omitempty"`
	Default []interface{} `json:"default,omitempty"`
	Importable
}

API API 配置数据结构

func (API) DefaultInt

func (api API) DefaultInt(i int, defaults ...int) int

DefaultInt 读取参数 Int

func (API) DefaultString

func (api API) DefaultString(i int, defaults ...string) string

DefaultString 读取参数 String

func (API) MergeDefaultQueryParam

func (api API) MergeDefaultQueryParam(param types.QueryParam, i int, sid string) types.QueryParam

MergeDefaultQueryParam 合并默认查询参数

func (API) ProcessIs

func (api API) ProcessIs(name string) bool

ProcessIs 检查处理器名称

func (*API) UnmarshalJSON

func (api *API) UnmarshalJSON(data []byte) error

UnmarshalJSON API 字段JSON解析

func (API) ValidateLoop

func (api API) ValidateLoop(name string) API

ValidateLoop 循环引用校验

type APIImp

type APIImp API

APIImp 导入配置数据结构

type AppInfo

type AppInfo struct {
	Name        string                 `json:"name,omitempty"`
	L           map[string]string      `json:"-"`
	Short       string                 `json:"short,omitempty"`
	Version     string                 `json:"version,omitempty"`
	Description string                 `json:"description,omitempty"`
	Icons       maps.MapStrSync        `json:"icons,omitempty"`
	Storage     AppStorage             `json:"storage,omitempty"`
	Option      map[string]interface{} `json:"option,omitempty"`
	XGen        string                 `json:"xgen,omitempty"`
	AdminRoot   string                 `json:"adminRoot,omitempty"`
	Static      *Static                `json:"public,omitempty"`
	Optional    map[string]interface{} `json:"optional,omitempty"`
}

AppInfo 应用信息

var App AppInfo

App 应用信息

func (AppInfo) Public

func (app AppInfo) Public() AppInfo

Public 输出公共信息

type AppRoot

type AppRoot struct {
	APIs    string
	Flows   string
	Models  string
	Plugins string
	Tables  string
	Charts  string
	Screens string
	Data    string
}

AppRoot 应用目录

type AppStorage

type AppStorage struct {
	Default string                 `json:"default"`
	Buckets map[string]string      `json:"buckets,omitempty"`
	S3      map[string]interface{} `json:"s3,omitempty"`
	OSS     *AppStorageOSS         `json:"oss,omitempty"`
	COS     map[string]interface{} `json:"cos,omitempty"`
}

AppStorage 应用存储

type AppStorageOSS

type AppStorageOSS struct {
	Endpoint    string `json:"endpoint,omitempty"`
	ID          string `json:"id,omitempty"`
	Secret      string `json:"secret,omitempty"`
	RoleArn     string `json:"roleArn,omitempty"`
	SessionName string `json:"sessionName,omitempty"`
}

AppStorageOSS 阿里云存储

type Column

type Column struct {
	Label  string `json:"label"`
	Export string `json:"export,omitempty"`
	View   Render `json:"view,omitempty"`
	Edit   Render `json:"edit,omitempty"`
	Form   Render `json:"form,omitempty"`
	Importable
}

Column 字段呈现方式

func (*Column) UnmarshalJSON

func (col *Column) UnmarshalJSON(data []byte) error

UnmarshalJSON Column 字段JSON解析

type ColumnImp

type ColumnImp Column

ColumnImp 导入模式查询过滤器

type Filter

type Filter struct {
	Label string `json:"label"`
	Bind  string `json:"bind,omitempty"`
	Input Render `json:"input,omitempty"`
	Importable
}

Filter 查询过滤器

func (*Filter) UnmarshalJSON

func (filter *Filter) UnmarshalJSON(data []byte) error

UnmarshalJSON Filter 字段JSON解析

type FilterImp

type FilterImp Filter

FilterImp 导入模式查询过滤器

type Importable

type Importable struct {
	Import string        `json:"@,omitempty"`  // 从 Global 或 Vendor 载入
	In     []interface{} `json:"in,omitempty"` // 从 Global 或 Vendor 载入, 解析参数
}

Importable 可导入JSON

type Page

type Page struct {
	Primary string                 `json:"primary"`
	Layout  map[string]interface{} `json:"layout"`
	Actions map[string]Render      `json:"actions,omitempty"`
	Option  map[string]interface{} `json:"option,omitempty"`
	Importable
}

Page 页面

func (*Page) UnmarshalJSON

func (page *Page) UnmarshalJSON(data []byte) error

UnmarshalJSON Page 字段JSON解析

type PageImp

type PageImp Page

PageImp 导入模式页面

type Render

type Render struct {
	Type       string                 `json:"type,omitempty"`
	Props      map[string]interface{} `json:"props,omitempty"`
	Components map[string]interface{} `json:"components,omitempty"`
	Importable
}

Render 组件渲染方式

func (*Render) UnmarshalJSON

func (render *Render) UnmarshalJSON(data []byte) error

UnmarshalJSON Render 字段JSON解析

type RenderImp

type RenderImp Render

RenderImp 导入模式组件渲染方式

type Script

type Script struct {
	Name    string
	Type    string
	Content []byte
	File    string
}

Script 脚本文件类型

func GetAppFile

func GetAppFile(root string, filepath string) Script

GetAppFile 读取文件

func GetAppFilesFS

func GetAppFilesFS(root string, typ string) []Script

GetAppFilesFS 遍历应用目录,读取文件列表

func GetAppPluginFile

func GetAppPluginFile(root string, file string) Script

GetAppPluginFile 读取文件

func GetAppPlugins

func GetAppPlugins(root string, typ string) []Script

GetAppPlugins 遍历应用目录,读取文件列表

func GetFile

func GetFile(root string, path string) Script

GetFile 读取文件

func GetFilesBin

func GetFilesBin(root string, typ string) []Script

GetFilesBin 从 bindata 中读取文件列表

func GetFilesFS

func GetFilesFS(root string, typ string) []Script

GetFilesFS 遍历目录,读取文件列表

type Static added in v0.10.3

type Static struct {
	PWA bool `json:"pwa,omitempty"`
}

Static setting

Jump to

Keyboard shortcuts

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