1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // Copyright 2019 autocareai.com. All rights reserved.
- // Use of this source code is governed by autocareai.com.
- package impl
- import (
- "context"
- "gadm-task/pb"
- pb_v1 "gadm-task/pb/v1"
- "gadm-task/impl/v1/check"
- "gadm-task/impl/v1/task"
- "gitlab.sydip.com/repo/gopkgs/tasker/rpctasker"
- "google.golang.org/grpc"
- )
- // 具体实现
- type Rcvr struct{}
- func Register(s *grpc.Server) {
- pb.RegisterAdmTaskServer(s, &Rcvr{})
- }
- func (c *Rcvr) GetTaskBySourceCode(ctx context.Context, req *pb_v1.GetTaskBySourceCodeRequest) (reply *pb_v1.GetTaskBySourceCodeReply, err error) {
- t1 := func() error {
- reply, err = task.GetTaskBySourceCode(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) UpdateOfflineTask(ctx context.Context, req *pb_v1.UpdateOfflineTaskRequest) (reply *pb_v1.UpdateOfflineTaskReply, err error) {
- t1 := func() error {
- reply, err = task.UpdateOfflineTask(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) CheckFormat(ctx context.Context, req *pb_v1.CheckFormatRequest) (reply *pb_v1.CheckFormatReply, err error) {
- t1 := func() error {
- reply, err = check.CheckFormat(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) FieldCheck(ctx context.Context, req *pb_v1.FieldCheckRequest) (reply *pb_v1.FieldCheckReply, err error) {
- t1 := func() error {
- reply, err = check.FieldCheck(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
|