123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package v1
- import (
- json2 "encoding/json"
- )
- const (
- GateProtocolSaiboHttpV1 = 1
- GateProtocolSaiboMqttV1 = 2
- GateProtocolYufanHttpV1 = 3
- )
- var GateProtocolNameMap = map[int32]string{
- GateProtocolSaiboHttpV1: "赛伯罗斯 http v1",
- GateProtocolSaiboMqttV1: "赛伯罗斯 mqtt v1",
- GateProtocolYufanHttpV1: "宇泛 http v1",
- }
- // 替换encoding/json包
- type JsonStruct struct {
- }
- func (p *JsonStruct) MarshalToString(v interface{}) (string, error) {
- bytes, err := json2.Marshal(v)
- return string(bytes), err
- }
- func (p *JsonStruct) Marshal(v interface{}) ([]byte, error) {
- bytes, err := json2.Marshal(v)
- return bytes, err
- }
- func (p *JsonStruct) Unmarshal(bytes []byte, v interface{}) error {
- err := json2.Unmarshal(bytes, v)
- return err
- }
- var json = &JsonStruct{}
- // Controller
- type Controller struct {
- }
- // NewController return a new controller
- func NewController() *Controller {
- return &Controller{}
- }
|