service/api/proto/accountrelation/proto/not_null_def_op.go

62 lines
2.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package proto
import (
"fmt"
"service/library/validator"
)
// op 创建
func (p *OpCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 1+len(p.AccountRelations))
params[0] = validator.NewStructSliceParam("请填写欲创建的用户关系!", len(p.AccountRelations))
for i, item := range p.AccountRelations {
params[1+i] = validator.NewStructPtrParam(fmt.Sprintf("欲创建的第%v个用户关系非空校验失败", i), item)
}
return
}
// op 删除
func (p *OpDeleteReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 1+len(p.Sentences))
params[0] = validator.NewStructSliceParam("请填写欲删除的用户关系!", len(p.Sentences))
for i, item := range p.Sentences {
params[1+i] = validator.NewStructPtrParam(fmt.Sprintf("欲创建的第%v个用户关系非空校验失败", i), item)
}
return
}
// op 更新
func (p *OpUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 3)
params[0] = validator.NewInt64PtrParam("请填写欲更新用户关系的主语mid", p.Sentence.SubMid)
params[1] = validator.NewInt64PtrParam("请填写欲更新用户关系的宾语mid", p.Sentence.ObjMid)
params[2] = validator.NewInt64PtrParam("请填写欲更新用户关系的关系谓词", p.Sentence.Predicate)
return params
}
// op 列表
func (p *OpListReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 1)
params[0] = validator.NewInt64PtrParam("mid should not be null", p.Mid)
return params
}
func (p *OpListBySentenceReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 3)
params[0] = validator.NewInt64PtrParam("请填写要查找的主语mid", p.SubMid)
params[1] = validator.NewInt64PtrParam("请填写要查找的宾语mid", p.ObjMid)
params[2] = validator.NewInt64PtrParam("请填写要查找的关系谓词", p.Predicate)
return params
}
// op 计数
func (p *OpCountReq) ProvideNotNullValue() (params []*validator.JsonParam) {
params = make([]*validator.JsonParam, 1)
params[0] = validator.NewInt64PtrParam("请填写欲计数的主语mid", p.Mid)
return params
}