sdk

package
v0.0.0-...-0bbac7a Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

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 V1_User_Add

func V1_User_Add(arg *args.AddUserArgsV1, setting ...socket.PacketSetting) (*args.AddUserResultV1, *tp.Rerror)

Add handler

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-template/user/args"
	"github.com/xiaoenai/tp-template/user/sdk"
)

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

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

func V1_User_Get

func V1_User_Get(arg *args.GetUserArgsV1, setting ...socket.PacketSetting) (*args.GetUserResultV1, *tp.Rerror)

Get handler

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-template/user/args"
	"github.com/xiaoenai/tp-template/user/sdk"
)

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

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

func V1_User_GetById

func V1_User_GetById(arg *args.GetUserByIdArgsV1, setting ...socket.PacketSetting) (*args.GetUserByIdResultV1, *tp.Rerror)

获取用户

Example
package main

import (
	"encoding/json"
	"fmt"

	tp "github.com/henrylee2cn/teleport"

	"github.com/xiaoenai/tp-template/user/args"
	"github.com/xiaoenai/tp-template/user/sdk"
)

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

func main() {
	result, rerr := sdk.V1_User_GetById(&args.GetUserByIdArgsV1{})
	if rerr != nil {
		tp.Errorf("V1_User_GetById: rerr: %s", toJsonBytes(rerr))
	} else {
		tp.Infof("V1_User_GetById: result: %s", toJsonBytes(result))
	}
	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