Skip to content

mxui-go-client is MXUI Golang client, which can use MXUI The platform quickly uses the API to generate UI components such as forms, tables, charts, file upload and download, audio and video playback and so on

License

Notifications You must be signed in to change notification settings

liyiligang/mxui-go-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


English | 简体中文

简介

mxui-go-client 是 MXUI 的golang客户端, 它能够通过 MXUI 平台快速的利用接口生成表单, 表格, 图表, 文件上传下载,音视频播放等UI组件

查看文档

在线预览

安装

go get -u github.com/liyiligang/mxui-go-client

基本用法

//初始化
client, err := mxui.InitMXUIClient(mxui.ClientConfig{
    Addr:"x.x.x.x:302",
    PublicKeyPath:"./cert/ca_cert.pem",
    CertName: "x.test.example.com",
    NodeName: "MyNode",
    ConnectTimeOut: time.Second * 5,
    RequestTimeOut: time.Second * 5,
    KeepaliveTime: time.Second * 1,
    NotifyCall: func (nodeNotify mxui.NodeNotify){
        fmt.Println("receive node notify: ", nodeNotify.Message)
    },
})
if err != nil {
    panic(err)
}

//定义接口
type resume struct {
    Name      	string
    Age       	int
    Boy		  	bool
    Occupation  string    `schema:"enum=teacher;sales;doctor"`
}

callFunc := func (form *resume) string {
    sex := "boy"
    if !form.Boy {
        sex = "girl"
    }
    return "Hello World, My Name is " + form.Name+ ", " + 
    strconv.Itoa(form.Age)+ " years old, "+ sex + ". I'm a " + 
    form.Occupation + "."
}

//创建接口可视化UI
err := client.RegisterNodeFunc(mxui.NodeFuncRegister{
    Name:     "Hello World",
    CallFunc: callFunc,
})
if err != nil {
    fmt.Println(err)
}

生成的UI

请求参数

返回值

联系方式

QQ交流群: 757595139

问题或建议

  • 有任何使用问题或者建议都可以提交至 Github issue 或者通过QQ群内联系我
  • 在提交 issue 之前,请搜索相关内容是否已被提出

License

Apache-2.0

About

mxui-go-client is MXUI Golang client, which can use MXUI The platform quickly uses the API to generate UI components such as forms, tables, charts, file upload and download, audio and video playback and so on

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages