Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"request.go",
"response.go",
],
importpath = "go-common/app/interface/main/broadcast/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/ecode:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,18 @@
package model
// ChangeRoomReq .
type ChangeRoomReq struct {
RoomID string `json:"room_id"`
}
// RegisterOpReq .
type RegisterOpReq struct {
Operation int32 `json:"operation"`
Operations []int32 `json:"operations"`
}
// UnregisterOpReq .
type UnregisterOpReq struct {
Operation int32 `json:"operation"`
Operations []int32 `json:"operations"`
}

View File

@@ -0,0 +1,24 @@
package model
import (
"encoding/json"
"go-common/library/ecode"
)
// Response .
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]interface{} `json:"data"`
}
// Message .
func Message(raw map[string]interface{}, e error) (bs []byte) {
res := &Response{
Code: ecode.Cause(e).Code(),
Message: ecode.Cause(e).Message(),
Data: raw,
}
bs, _ = json.Marshal(res)
return
}