github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/grpcwrapper/rawydb/operation_params.go (about)

     1  package rawydb
     2  
     3  import (
     4  	"github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Operations"
     5  
     6  	"github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawoptional"
     7  )
     8  
     9  type OperationParams struct {
    10  	OperationMode OperationParamsMode
    11  
    12  	OperationTimeout rawoptional.Duration
    13  	CancelAfter      rawoptional.Duration
    14  }
    15  
    16  func (p *OperationParams) ToProto() *Ydb_Operations.OperationParams {
    17  	res := &Ydb_Operations.OperationParams{
    18  		OperationMode: p.OperationMode.ToProto(),
    19  	}
    20  	res.OperationTimeout = p.OperationTimeout.ToProto()
    21  	res.CancelAfter = p.CancelAfter.ToProto()
    22  
    23  	return res
    24  }
    25  
    26  type OperationParamsMode int
    27  
    28  const (
    29  	OperationParamsModeUnspecified OperationParamsMode = 0
    30  	OperationParamsModeSync        OperationParamsMode = 1
    31  	OperationParamsModeAsync       OperationParamsMode = 2
    32  )
    33  
    34  func (mode OperationParamsMode) ToProto() Ydb_Operations.OperationParams_OperationMode {
    35  	return Ydb_Operations.OperationParams_OperationMode(mode)
    36  }