Create & Init Project...
This commit is contained in:
58
app/service/main/rank/model/BUILD
Normal file
58
app/service/main/rank/model/BUILD
Normal file
@ -0,0 +1,58 @@
|
||||
load(
|
||||
"@io_bazel_rules_go//proto:def.bzl",
|
||||
"go_proto_library",
|
||||
)
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "model_proto",
|
||||
srcs = ["model.proto"],
|
||||
tags = ["automanaged"],
|
||||
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
|
||||
)
|
||||
|
||||
go_proto_library(
|
||||
name = "model_go_proto",
|
||||
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
|
||||
importpath = "go-common/app/service/main/rank/model",
|
||||
proto = ":model_proto",
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//library/time:go_default_library",
|
||||
"@com_github_gogo_protobuf//gogoproto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["model.go"],
|
||||
embed = [":model_go_proto"],
|
||||
importpath = "go-common/app/service/main/rank/model",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/time:go_default_library",
|
||||
"@com_github_gogo_protobuf//gogoproto:go_default_library",
|
||||
"@com_github_golang_protobuf//proto: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"],
|
||||
)
|
191
app/service/main/rank/model/model.go
Normal file
191
app/service/main/rank/model/model.go
Normal file
@ -0,0 +1,191 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
xtime "go-common/library/time"
|
||||
)
|
||||
|
||||
const (
|
||||
// BusinessArchive .
|
||||
BusinessArchive = "archive"
|
||||
// RankOrderByDesc .
|
||||
RankOrderByDesc = "desc"
|
||||
// RankOrderByAsc .
|
||||
RankOrderByAsc = "asc"
|
||||
// SyncInsert .
|
||||
SyncInsert = "insert"
|
||||
// SyncUpdate .
|
||||
SyncUpdate = "update"
|
||||
// SyncDelete .
|
||||
SyncDelete = "delete"
|
||||
// TimeFormat .
|
||||
TimeFormat = "2006-01-02 15:04:05"
|
||||
// FlagExist .
|
||||
FlagExist = true
|
||||
)
|
||||
|
||||
// ArchiveMeta .
|
||||
type ArchiveMeta struct {
|
||||
ID int64 `json:"id"`
|
||||
Aid int64 `json:"aid"`
|
||||
Typeid int64 `json:"typeid"`
|
||||
Pubtime Stime `json:"pubtime"`
|
||||
*ArchiveType
|
||||
*ArchiveStat
|
||||
*ArchiveTv
|
||||
}
|
||||
|
||||
// ArchiveType .
|
||||
type ArchiveType struct {
|
||||
ID int64 `json:"id"`
|
||||
Pid int64 `json:"pid"`
|
||||
}
|
||||
|
||||
// ArchiveStat .
|
||||
type ArchiveStat struct {
|
||||
ID int64 `json:"id"`
|
||||
Aid int64 `json:"aid"`
|
||||
Click int64 `json:"click"`
|
||||
}
|
||||
|
||||
// ArchiveTv .
|
||||
type ArchiveTv struct {
|
||||
ID int64 `json:"id"`
|
||||
Aid int64 `json:"aid"`
|
||||
Result int8 `json:"result"`
|
||||
Deleted int8 `json:"deleted"`
|
||||
Valid int8 `json:"valid"`
|
||||
}
|
||||
|
||||
// StatViewMsg .
|
||||
type StatViewMsg struct {
|
||||
Type string `json:"type"`
|
||||
ID int64 `json:"id"`
|
||||
Count int `json:"count"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// CanalMsg .
|
||||
type CanalMsg struct {
|
||||
Action string `json:"action"`
|
||||
Table string `json:"table"`
|
||||
New json.RawMessage `json:"new"`
|
||||
Old json.RawMessage `json:"old"`
|
||||
}
|
||||
|
||||
// SetPubtime .
|
||||
func (a *ArchiveMeta) SetPubtime() xtime.Time {
|
||||
return xtime.Time(a.Pubtime)
|
||||
}
|
||||
|
||||
// SetPid .
|
||||
func (a *ArchiveType) SetPid() int16 {
|
||||
return int16(a.Pid)
|
||||
}
|
||||
|
||||
// SetClick .
|
||||
func (a *ArchiveStat) SetClick() int {
|
||||
return int(a.Click)
|
||||
}
|
||||
|
||||
// DoReq .
|
||||
type DoReq struct {
|
||||
Business string `form:"business" validate:"required"`
|
||||
Action string `form:"action" validate:"required"`
|
||||
MinID int64 `form:"minid"`
|
||||
MaxID int64 `form:"maxid"`
|
||||
BeginTime string `form:"begintime"`
|
||||
EndTime string `form:"endtime"`
|
||||
}
|
||||
|
||||
// MgetReq .
|
||||
type MgetReq struct {
|
||||
Business string `form:"business" validate:"required"`
|
||||
Oids []int64 `form:"oids,split" validate:"required"`
|
||||
}
|
||||
|
||||
// MgetResp resp of mget
|
||||
type MgetResp struct {
|
||||
List map[int64]*Field `json:"list"`
|
||||
}
|
||||
|
||||
// SortReq .
|
||||
type SortReq struct {
|
||||
Business string `form:"business" validate:"required"`
|
||||
Field string `form:"field" validate:"required"`
|
||||
Order string `form:"order" validate:"required"`
|
||||
Filters map[string]string `form:"filters" validate:"required"`
|
||||
Oids []int64 `form:"oids,split" validate:"required"`
|
||||
Pn int `form:"pn"`
|
||||
Ps int `form:"ps"`
|
||||
}
|
||||
|
||||
// SortResp .
|
||||
type SortResp struct {
|
||||
Result []int64 `json:"result"`
|
||||
Page *Page `json:"page"`
|
||||
}
|
||||
|
||||
// GroupReq .
|
||||
type GroupReq struct {
|
||||
Business string `form:"business" validate:"required"`
|
||||
Field string `form:"field" validate:"required"`
|
||||
Oids []int64 `form:"Oids,split" validate:"required"`
|
||||
}
|
||||
|
||||
// GroupResp .
|
||||
type GroupResp struct {
|
||||
List []*Group `json:"list"`
|
||||
}
|
||||
|
||||
// Group .
|
||||
type Group struct {
|
||||
Key string `json:"key"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// Page Pager
|
||||
type Page struct {
|
||||
Pn int `json:"pn"`
|
||||
Ps int `json:"ps"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// Stime .
|
||||
type Stime int64
|
||||
|
||||
// Scan scan time.
|
||||
func (st *Stime) Scan(src interface{}) (err error) {
|
||||
switch sc := src.(type) {
|
||||
case time.Time:
|
||||
*st = Stime(sc.Unix())
|
||||
case string:
|
||||
var i int64
|
||||
i, err = strconv.ParseInt(sc, 10, 64)
|
||||
*st = Stime(i)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Value get time value.
|
||||
func (st Stime) Value() (driver.Value, error) {
|
||||
return time.Unix(int64(st), 0), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (st *Stime) UnmarshalJSON(data []byte) error {
|
||||
timestamp, err := strconv.ParseInt(string(data), 10, 64)
|
||||
if err == nil {
|
||||
*st = Stime(timestamp)
|
||||
return nil
|
||||
}
|
||||
t, err := time.ParseInLocation(`"2006-01-02 15:04:05"`, string(data), time.Local)
|
||||
if err == nil {
|
||||
*st = Stime(t.Unix())
|
||||
}
|
||||
return nil
|
||||
}
|
679
app/service/main/rank/model/model.pb.go
Normal file
679
app/service/main/rank/model/model.pb.go
Normal file
@ -0,0 +1,679 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: model.proto
|
||||
|
||||
/*
|
||||
Package model is a generated protocol buffer package.
|
||||
|
||||
|
||||
v0.1.0
|
||||
收藏夹信息
|
||||
|
||||
It is generated from these files:
|
||||
model.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Field
|
||||
Fields
|
||||
*/
|
||||
package model
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import go_common_library_time "go-common/library/time"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Field struct {
|
||||
Flag bool `protobuf:"varint,1,opt,name=Flag,proto3" json:"flag"`
|
||||
Oid int64 `protobuf:"varint,2,opt,name=Oid,proto3" json:"oid"`
|
||||
Pid int16 `protobuf:"varint,3,opt,name=Pid,proto3,casttype=int16" json:"pid"`
|
||||
Click int `protobuf:"varint,4,opt,name=Click,proto3,casttype=int" json:"click"`
|
||||
Pubtime go_common_library_time.Time `protobuf:"varint,5,opt,name=Pubtime,proto3,casttype=go-common/library/time.Time" json:"pubtime"`
|
||||
Result int8 `protobuf:"varint,6,opt,name=Result,proto3,casttype=int8" json:"result"`
|
||||
Deleted int8 `protobuf:"varint,7,opt,name=Deleted,proto3,casttype=int8" json:"deleted"`
|
||||
Valid int8 `protobuf:"varint,8,opt,name=Valid,proto3,casttype=int8" json:"valid"`
|
||||
}
|
||||
|
||||
func (m *Field) Reset() { *m = Field{} }
|
||||
func (*Field) ProtoMessage() {}
|
||||
func (*Field) Descriptor() ([]byte, []int) { return fileDescriptorModel, []int{0} }
|
||||
|
||||
type Fields struct {
|
||||
Fields []*Field `protobuf:"bytes,1,rep,name=Fields" json:"Fields,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Fields) Reset() { *m = Fields{} }
|
||||
func (*Fields) ProtoMessage() {}
|
||||
func (*Fields) Descriptor() ([]byte, []int) { return fileDescriptorModel, []int{1} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Field)(nil), "model.Field")
|
||||
proto.RegisterType((*Fields)(nil), "model.Fields")
|
||||
}
|
||||
func (m *Field) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Field) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Flag {
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
if m.Flag {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i++
|
||||
}
|
||||
if m.Oid != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Oid))
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
dAtA[i] = 0x18
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Pid))
|
||||
}
|
||||
if m.Click != 0 {
|
||||
dAtA[i] = 0x20
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Click))
|
||||
}
|
||||
if m.Pubtime != 0 {
|
||||
dAtA[i] = 0x28
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Pubtime))
|
||||
}
|
||||
if m.Result != 0 {
|
||||
dAtA[i] = 0x30
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Result))
|
||||
}
|
||||
if m.Deleted != 0 {
|
||||
dAtA[i] = 0x38
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Deleted))
|
||||
}
|
||||
if m.Valid != 0 {
|
||||
dAtA[i] = 0x40
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(m.Valid))
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *Fields) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Fields) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Fields) > 0 {
|
||||
for _, msg := range m.Fields {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintModel(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeVarintModel(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func (m *Field) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.Flag {
|
||||
n += 2
|
||||
}
|
||||
if m.Oid != 0 {
|
||||
n += 1 + sovModel(uint64(m.Oid))
|
||||
}
|
||||
if m.Pid != 0 {
|
||||
n += 1 + sovModel(uint64(m.Pid))
|
||||
}
|
||||
if m.Click != 0 {
|
||||
n += 1 + sovModel(uint64(m.Click))
|
||||
}
|
||||
if m.Pubtime != 0 {
|
||||
n += 1 + sovModel(uint64(m.Pubtime))
|
||||
}
|
||||
if m.Result != 0 {
|
||||
n += 1 + sovModel(uint64(m.Result))
|
||||
}
|
||||
if m.Deleted != 0 {
|
||||
n += 1 + sovModel(uint64(m.Deleted))
|
||||
}
|
||||
if m.Valid != 0 {
|
||||
n += 1 + sovModel(uint64(m.Valid))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Fields) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Fields) > 0 {
|
||||
for _, e := range m.Fields {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovModel(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovModel(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozModel(x uint64) (n int) {
|
||||
return sovModel(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *Field) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&Field{`,
|
||||
`Flag:` + fmt.Sprintf("%v", this.Flag) + `,`,
|
||||
`Oid:` + fmt.Sprintf("%v", this.Oid) + `,`,
|
||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||
`Click:` + fmt.Sprintf("%v", this.Click) + `,`,
|
||||
`Pubtime:` + fmt.Sprintf("%v", this.Pubtime) + `,`,
|
||||
`Result:` + fmt.Sprintf("%v", this.Result) + `,`,
|
||||
`Deleted:` + fmt.Sprintf("%v", this.Deleted) + `,`,
|
||||
`Valid:` + fmt.Sprintf("%v", this.Valid) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *Fields) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&Fields{`,
|
||||
`Fields:` + strings.Replace(fmt.Sprintf("%v", this.Fields), "Field", "Field", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringModel(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
func (m *Field) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Field: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Field: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Flag", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.Flag = bool(v != 0)
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Oid", wireType)
|
||||
}
|
||||
m.Oid = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Oid |= (int64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
|
||||
}
|
||||
m.Pid = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Pid |= (int16(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Click", wireType)
|
||||
}
|
||||
m.Click = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Click |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Pubtime", wireType)
|
||||
}
|
||||
m.Pubtime = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Pubtime |= (go_common_library_time.Time(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
|
||||
}
|
||||
m.Result = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Result |= (int8(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 7:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Deleted", wireType)
|
||||
}
|
||||
m.Deleted = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Deleted |= (int8(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 8:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType)
|
||||
}
|
||||
m.Valid = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Valid |= (int8(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipModel(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthModel
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Fields) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Fields: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Fields: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthModel
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Fields = append(m.Fields, &Field{})
|
||||
if err := m.Fields[len(m.Fields)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipModel(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthModel
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipModel(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthModel
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowModel
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipModel(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthModel = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowModel = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("model.proto", fileDescriptorModel) }
|
||||
|
||||
var fileDescriptorModel = []byte{
|
||||
// 376 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x91, 0xcf, 0x8e, 0xd3, 0x30,
|
||||
0x10, 0x87, 0xeb, 0x4d, 0x9d, 0x54, 0x5e, 0x0e, 0x60, 0x2e, 0xe6, 0x8f, 0xec, 0xa8, 0x42, 0x50,
|
||||
0xad, 0xd4, 0x54, 0x80, 0x84, 0x38, 0x97, 0xd5, 0x5e, 0x59, 0x59, 0x88, 0x7b, 0x12, 0x7b, 0x83,
|
||||
0x85, 0x13, 0x57, 0x59, 0x07, 0x89, 0x1b, 0x8f, 0xc1, 0x23, 0xed, 0x71, 0x4f, 0x88, 0x93, 0x45,
|
||||
0xc3, 0x2d, 0x8f, 0x90, 0xd3, 0xca, 0x4e, 0xdb, 0xdb, 0xcc, 0xf7, 0xfb, 0x46, 0x23, 0x7b, 0xd0,
|
||||
0x79, 0x6d, 0x84, 0xd4, 0xd9, 0xae, 0x35, 0xd6, 0x60, 0x18, 0x9a, 0xe7, 0xeb, 0x4a, 0xd9, 0x6f,
|
||||
0x5d, 0x91, 0x95, 0xa6, 0xde, 0x54, 0xa6, 0x32, 0x9b, 0x90, 0x16, 0xdd, 0x4d, 0xe8, 0x42, 0x13,
|
||||
0xaa, 0x69, 0x6a, 0xf9, 0xe7, 0x0c, 0xc1, 0x2b, 0x25, 0xb5, 0xc0, 0x2f, 0xd1, 0xfc, 0x4a, 0xe7,
|
||||
0x15, 0x01, 0x29, 0x58, 0x2d, 0xb6, 0x8b, 0xc1, 0xb1, 0xf9, 0x8d, 0xce, 0x2b, 0x1e, 0x28, 0x7e,
|
||||
0x86, 0xa2, 0xcf, 0x4a, 0x90, 0xb3, 0x14, 0xac, 0xa2, 0x6d, 0x32, 0x38, 0x16, 0x19, 0x25, 0xb8,
|
||||
0x67, 0x78, 0x89, 0xa2, 0x6b, 0x25, 0x48, 0x94, 0x82, 0x15, 0xdc, 0x3e, 0xf6, 0xd1, 0x4e, 0x89,
|
||||
0xd1, 0x31, 0xa8, 0x1a, 0xfb, 0xf6, 0x03, 0xf7, 0x21, 0x7e, 0x8d, 0xe0, 0x27, 0xad, 0xca, 0xef,
|
||||
0x64, 0x7e, 0xb2, 0x60, 0xe9, 0xc1, 0xe8, 0x58, 0xa4, 0x1a, 0xcb, 0xa7, 0x18, 0x5f, 0xa2, 0xe4,
|
||||
0xba, 0x2b, 0xac, 0xaa, 0x25, 0x81, 0x61, 0xd5, 0xc5, 0xe0, 0x58, 0xb2, 0x9b, 0xd0, 0xe8, 0xd8,
|
||||
0x8b, 0xca, 0xac, 0x4b, 0x53, 0xd7, 0xa6, 0xd9, 0x68, 0x55, 0xb4, 0x79, 0xfb, 0x73, 0xe3, 0x93,
|
||||
0xec, 0x8b, 0xaa, 0x25, 0x3f, 0x8e, 0xe2, 0x0b, 0x14, 0x73, 0x79, 0xdb, 0x69, 0x4b, 0xe2, 0xb0,
|
||||
0x0e, 0x0f, 0x8e, 0xc5, 0x6d, 0x20, 0xa3, 0x63, 0x73, 0xd5, 0xd8, 0x8f, 0xfc, 0x60, 0xe0, 0x35,
|
||||
0x4a, 0x2e, 0xa5, 0x96, 0x56, 0x0a, 0x92, 0x04, 0xf9, 0xa9, 0xdf, 0x28, 0x26, 0x74, 0xb2, 0x8f,
|
||||
0x0e, 0x7e, 0x83, 0xe0, 0xd7, 0x5c, 0x2b, 0x41, 0x16, 0x41, 0x7e, 0xe2, 0x1f, 0xf2, 0xc3, 0x83,
|
||||
0x93, 0x3a, 0xe5, 0xcb, 0x0c, 0xc5, 0xe1, 0x5f, 0x6f, 0xf1, 0xab, 0x63, 0x45, 0x40, 0x1a, 0xad,
|
||||
0xce, 0xdf, 0x3d, 0xca, 0xa6, 0xb3, 0x05, 0xc8, 0x0f, 0xd9, 0x36, 0xbd, 0xdb, 0xd3, 0xd9, 0xfd,
|
||||
0x9e, 0xce, 0xfe, 0xee, 0xe9, 0xec, 0x57, 0x4f, 0xc1, 0x5d, 0x4f, 0xc1, 0x7d, 0x4f, 0xc1, 0xbf,
|
||||
0x9e, 0x82, 0xdf, 0xff, 0xe9, 0xac, 0x88, 0xc3, 0xc5, 0xde, 0x3f, 0x04, 0x00, 0x00, 0xff, 0xff,
|
||||
0x09, 0x14, 0xcb, 0x4c, 0xf6, 0x01, 0x00, 0x00,
|
||||
}
|
32
app/service/main/rank/model/model.proto
Normal file
32
app/service/main/rank/model/model.proto
Normal file
@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
|
||||
/*
|
||||
* v0.1.0
|
||||
* 收藏夹信息
|
||||
*/
|
||||
package model;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
|
||||
message Field {
|
||||
bool Flag = 1 [(gogoproto.jsontag) = "flag"];
|
||||
int64 Oid = 2 [(gogoproto.jsontag) = "oid"];
|
||||
int32 Pid = 3 [(gogoproto.jsontag) = "pid",(gogoproto.casttype) = "int16"];
|
||||
int32 Click = 4 [(gogoproto.jsontag) = "click",(gogoproto.casttype) = "int"];
|
||||
int64 Pubtime = 5 [(gogoproto.jsontag) = "pubtime", (gogoproto.casttype) = "go-common/library/time.Time"];
|
||||
int32 Result = 6 [(gogoproto.jsontag) = "result",(gogoproto.casttype) = "int8"];
|
||||
int32 Deleted = 7 [(gogoproto.jsontag) = "deleted",(gogoproto.casttype) = "int8"];
|
||||
int32 Valid = 8 [(gogoproto.jsontag) = "valid",(gogoproto.casttype) = "int8"];
|
||||
}
|
||||
|
||||
message Fields{
|
||||
repeated Field Fields= 1;
|
||||
}
|
Reference in New Issue
Block a user