sdk

package
v6.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home(arg *args.EmptyStruct, setting ...tp.MessageSetting) (*args.HomeResult, *tp.Status)

Home handler

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-micro/examples/project/args"
	"github.com/xiaoenai/tp-micro/examples/project/sdk"
)

func toJsonBytes(i interface{}) []byte {
	b, _ := json.MarshalIndent(i, "", "  ")
	return b
}

func main() {
	result, status := sdk.Home(&args.EmptyStruct{})
	if status != nil {
		tp.Errorf("Home: status: %s", toJsonBytes(status))
	} else {
		tp.Infof("Home: result: %s", toJsonBytes(result))
	}
	fmt.Printf("")
}
Output:

func Init

func Init(cliConfig micro.CliConfig, etcdConfing etcd.EasyConfig)

Init initializes client with configs.

func InitWithClient

func InitWithClient(cli *micro.Client)

InitWithClient initializes client with specified object.

func Math_Divide

func Math_Divide(arg *args.DivideArg, setting ...tp.MessageSetting) (*args.DivideResult, *tp.Status)

Divide handler

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-micro/examples/project/args"
	"github.com/xiaoenai/tp-micro/examples/project/sdk"
)

func toJsonBytes(i interface{}) []byte {
	b, _ := json.MarshalIndent(i, "", "  ")
	return b
}

func main() {
	result, status := sdk.Math_Divide(&args.DivideArg{})
	if status != nil {
		tp.Errorf("Math_Divide: status: %s", toJsonBytes(status))
	} else {
		tp.Infof("Math_Divide: result: %s", toJsonBytes(result))
	}
	fmt.Printf("")
}
Output:

func Stat

func Stat(arg *args.StatArg, setting ...tp.MessageSetting) *tp.Status

Stat handler

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-micro/examples/project/args"
	"github.com/xiaoenai/tp-micro/examples/project/sdk"
)

func toJsonBytes(i interface{}) []byte {
	b, _ := json.MarshalIndent(i, "", "  ")
	return b
}

func main() {
	status := sdk.Stat(&args.StatArg{})
	if status != nil {
		tp.Errorf("Stat: status: %s", toJsonBytes(status))
	}
	fmt.Printf("")
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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