using meta v5
This commit is contained in:
parent
0001faaf6e
commit
bf1ababe94
|
@ -11,7 +11,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.bit5.ru/backend/meta/v4"
|
||||
"git.bit5.ru/backend/meta/v5"
|
||||
"git.bit5.ru/backend/versioning"
|
||||
"git.bit5.ru/gomodules/metadb"
|
||||
"github.com/go-logr/logr"
|
||||
|
@ -95,11 +95,15 @@ type Rpc interface {
|
|||
Error() (int32, string)
|
||||
SetError(int32, string)
|
||||
|
||||
Request() meta.Readable
|
||||
Request() meta.ReadableWritable
|
||||
Response() meta.ReadableWritable
|
||||
|
||||
Execute(RpcContext, RpcHandler) error
|
||||
|
||||
ReadRequest(meta.Reader) error
|
||||
WriteRequest(meta.Writer) error
|
||||
|
||||
ReadResponse(meta.Reader) error
|
||||
WriteResponse(meta.Writer) error
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,28 @@ func (rpc {{ name }}) Execute(ctx RpcContext, h RpcHandler) error {
|
|||
return h.{{ prefix }}(ctx, rpc)
|
||||
}
|
||||
|
||||
func (rpc {{ name }}) Request() meta.Readable {
|
||||
func (rpc {{ name }}) Request() meta.ReadableWritable {
|
||||
return rpc.Req
|
||||
}
|
||||
|
||||
func (rpc {{ name }}) Response() meta.ReadableWritable {
|
||||
return rpc.Rsp
|
||||
}
|
||||
|
||||
func (rpc *{{ name }}) ReadRequest(reader meta.Reader) error {
|
||||
return rpc.Req.Read(reader)
|
||||
}
|
||||
|
||||
func (rpc *{{ name }}) WriteRequest(writer meta.Writer) error {
|
||||
return rpc.Req.Write(writer)
|
||||
}
|
||||
|
||||
func (rpc *{{ name }}) ReadResponse(reader meta.Reader) error {
|
||||
rpc.errCode = 0
|
||||
rpc.errMsg = ""
|
||||
return rpc.Rsp.Read(reader)
|
||||
}
|
||||
|
||||
func (rpc *{{ name }}) WriteResponse(writer meta.Writer) error {
|
||||
return rpc.Rsp.Write(writer)
|
||||
}
|
||||
|
|
|
@ -621,7 +621,7 @@ func (s *{{ name|default(s.name) }}) ReadFields(reader meta.Reader) error {
|
|||
{% set name = fname|split('.')|last %}
|
||||
{% set size_var = name|lcfirst ~ 'Size' %}
|
||||
{% set tmp_var = 'tmp' ~ name %}
|
||||
if err := reader.BeginContainer("{{ alias }}"); err != nil {
|
||||
if err := reader.BeginCollection("{{ alias }}"); err != nil {
|
||||
if err != meta.FieldNotFound {
|
||||
return err
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ func (s *{{ name|default(s.name) }}) ReadFields(reader meta.Reader) error {
|
|||
{{ _self.meta_read_field(type.value, tmp_var, '', tokens) }}
|
||||
{{ fname }} = append({{ fname }}, {{ tmp_var }})
|
||||
}
|
||||
if err := reader.EndContainer(); err != nil {
|
||||
if err := reader.EndCollection(); err != nil {
|
||||
return err
|
||||
}
|
||||
{% if has_table_token %}
|
||||
|
|
Loading…
Reference in New Issue