echo_thrift

package module
v0.0.0-...-04fd56a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

echo_thrift

Thrift IDL codec sample.

NOTE: In development!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBuffer

type CBuffer struct {
	// contains filtered or unexported fields
}

CBuffer Rust buffer for Go

func (CBuffer) AsBytes

func (b CBuffer) AsBytes() []byte

func (CBuffer) AsString

func (b CBuffer) AsString() string

func (CBuffer) Free

func (b CBuffer) Free()

Free free rust memory buffer, must be called!

func (CBuffer) Len

func (b CBuffer) Len() int

type GoFFI

type GoFFI interface {
	EchoGo(ctx context.Context, req *Ping) (r *Pong, err error)
}

type GoFFIClient

type GoFFIClient struct {
	// contains filtered or unexported fields
}

func NewGoFFIClient

func NewGoFFIClient(c thrift.TClient) *GoFFIClient

func NewGoFFIClientProtocol

func NewGoFFIClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *GoFFIClient

func (*GoFFIClient) Client_

func (p *GoFFIClient) Client_() thrift.TClient

func (*GoFFIClient) EchoGo

func (p *GoFFIClient) EchoGo(ctx context.Context, req *Ping) (r *Pong, err error)

type GoFFIEchoGoArgs

type GoFFIEchoGoArgs struct {
	Req *Ping `thrift:"req,1" json:"req"`
}

func NewGoFFIEchoGoArgs

func NewGoFFIEchoGoArgs() *GoFFIEchoGoArgs

func (*GoFFIEchoGoArgs) GetReq

func (p *GoFFIEchoGoArgs) GetReq() (v *Ping)

func (*GoFFIEchoGoArgs) IsSetReq

func (p *GoFFIEchoGoArgs) IsSetReq() bool

func (*GoFFIEchoGoArgs) Read

func (p *GoFFIEchoGoArgs) Read(iprot thrift.TProtocol) (err error)

func (*GoFFIEchoGoArgs) ReadField1

func (p *GoFFIEchoGoArgs) ReadField1(iprot thrift.TProtocol) error

func (*GoFFIEchoGoArgs) String

func (p *GoFFIEchoGoArgs) String() string

func (*GoFFIEchoGoArgs) Write

func (p *GoFFIEchoGoArgs) Write(oprot thrift.TProtocol) (err error)

type GoFFIEchoGoResult

type GoFFIEchoGoResult struct {
	Success *Pong `thrift:"success,0,optional" json:"success,omitempty"`
}

func NewGoFFIEchoGoResult

func NewGoFFIEchoGoResult() *GoFFIEchoGoResult

func (*GoFFIEchoGoResult) GetSuccess

func (p *GoFFIEchoGoResult) GetSuccess() (v *Pong)

func (*GoFFIEchoGoResult) IsSetSuccess

func (p *GoFFIEchoGoResult) IsSetSuccess() bool

func (*GoFFIEchoGoResult) Read

func (p *GoFFIEchoGoResult) Read(iprot thrift.TProtocol) (err error)

func (*GoFFIEchoGoResult) ReadField0

func (p *GoFFIEchoGoResult) ReadField0(iprot thrift.TProtocol) error

func (*GoFFIEchoGoResult) String

func (p *GoFFIEchoGoResult) String() string

func (*GoFFIEchoGoResult) Write

func (p *GoFFIEchoGoResult) Write(oprot thrift.TProtocol) (err error)

type GoFFIProcessor

type GoFFIProcessor struct {
	// contains filtered or unexported fields
}

func NewGoFFIProcessor

func NewGoFFIProcessor(handler GoFFI) *GoFFIProcessor

func (*GoFFIProcessor) AddToProcessorMap

func (p *GoFFIProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*GoFFIProcessor) GetProcessorFunction

func (p *GoFFIProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*GoFFIProcessor) Process

func (p *GoFFIProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*GoFFIProcessor) ProcessorMap

func (p *GoFFIProcessor) ProcessorMap() map[string]thrift.TProcessorFunction

type Ping

type Ping struct {
	Msg string `thrift:"msg,1" json:"msg"`
}
var GoFFIEchoGoArgs_Req_DEFAULT *Ping
var RustFFIEchoRsArgs_Req_DEFAULT *Ping

func NewPing

func NewPing() *Ping

func (*Ping) GetMsg

func (p *Ping) GetMsg() (v string)

func (*Ping) Read

func (p *Ping) Read(iprot thrift.TProtocol) (err error)

func (*Ping) ReadField1

func (p *Ping) ReadField1(iprot thrift.TProtocol) error

func (*Ping) String

func (p *Ping) String() string

func (*Ping) Write

func (p *Ping) Write(oprot thrift.TProtocol) (err error)

type Pong

type Pong struct {
	Msg string `thrift:"msg,1" json:"msg"`
}
var GoFFIEchoGoResult_Success_DEFAULT *Pong
var RustFFIEchoRsResult_Success_DEFAULT *Pong

func NewPong

func NewPong() *Pong

func (*Pong) GetMsg

func (p *Pong) GetMsg() (v string)

func (*Pong) Read

func (p *Pong) Read(iprot thrift.TProtocol) (err error)

func (*Pong) ReadField1

func (p *Pong) ReadField1(iprot thrift.TProtocol) error

func (*Pong) String

func (p *Pong) String() string

func (*Pong) Write

func (p *Pong) Write(oprot thrift.TProtocol) (err error)

type ResultCode

type ResultCode = int8
const (
	RcNoError ResultCode = 0
	RcDecode  ResultCode = -1
	RcEncode  ResultCode = -2
	RcUnknown ResultCode = -128
)

type RustFFI

type RustFFI interface {
	EchoRs(ctx context.Context, req *Ping) (r *Pong, err error)
}

type RustFFIClient

type RustFFIClient struct {
	// contains filtered or unexported fields
}

func NewRustFFIClient

func NewRustFFIClient(c thrift.TClient) *RustFFIClient

func NewRustFFIClientProtocol

func NewRustFFIClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *RustFFIClient

func (*RustFFIClient) Client_

func (p *RustFFIClient) Client_() thrift.TClient

func (*RustFFIClient) EchoRs

func (p *RustFFIClient) EchoRs(ctx context.Context, req *Ping) (r *Pong, err error)

type RustFFIEchoRsArgs

type RustFFIEchoRsArgs struct {
	Req *Ping `thrift:"req,1" json:"req"`
}

func NewRustFFIEchoRsArgs

func NewRustFFIEchoRsArgs() *RustFFIEchoRsArgs

func (*RustFFIEchoRsArgs) GetReq

func (p *RustFFIEchoRsArgs) GetReq() (v *Ping)

func (*RustFFIEchoRsArgs) IsSetReq

func (p *RustFFIEchoRsArgs) IsSetReq() bool

func (*RustFFIEchoRsArgs) Read

func (p *RustFFIEchoRsArgs) Read(iprot thrift.TProtocol) (err error)

func (*RustFFIEchoRsArgs) ReadField1

func (p *RustFFIEchoRsArgs) ReadField1(iprot thrift.TProtocol) error

func (*RustFFIEchoRsArgs) String

func (p *RustFFIEchoRsArgs) String() string

func (*RustFFIEchoRsArgs) Write

func (p *RustFFIEchoRsArgs) Write(oprot thrift.TProtocol) (err error)

type RustFFIEchoRsResult

type RustFFIEchoRsResult struct {
	Success *Pong `thrift:"success,0,optional" json:"success,omitempty"`
}

func NewRustFFIEchoRsResult

func NewRustFFIEchoRsResult() *RustFFIEchoRsResult

func (*RustFFIEchoRsResult) GetSuccess

func (p *RustFFIEchoRsResult) GetSuccess() (v *Pong)

func (*RustFFIEchoRsResult) IsSetSuccess

func (p *RustFFIEchoRsResult) IsSetSuccess() bool

func (*RustFFIEchoRsResult) Read

func (p *RustFFIEchoRsResult) Read(iprot thrift.TProtocol) (err error)

func (*RustFFIEchoRsResult) ReadField0

func (p *RustFFIEchoRsResult) ReadField0(iprot thrift.TProtocol) error

func (*RustFFIEchoRsResult) String

func (p *RustFFIEchoRsResult) String() string

func (*RustFFIEchoRsResult) Write

func (p *RustFFIEchoRsResult) Write(oprot thrift.TProtocol) (err error)

type RustFFIProcessor

type RustFFIProcessor struct {
	// contains filtered or unexported fields
}

func NewRustFFIProcessor

func NewRustFFIProcessor(handler RustFFI) *RustFFIProcessor

func (*RustFFIProcessor) AddToProcessorMap

func (p *RustFFIProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*RustFFIProcessor) GetProcessorFunction

func (p *RustFFIProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*RustFFIProcessor) Process

func (p *RustFFIProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*RustFFIProcessor) ProcessorMap

func (p *RustFFIProcessor) ProcessorMap() map[string]thrift.TProcessorFunction

type RustFfi

type RustFfi interface {
	EchoRs(req TBytes[*Ping]) RustFfiResult[Pong]
}
var GlobalRustFfi RustFfi = RustFfiImpl{}

type RustFfiImpl

type RustFfiImpl struct{}

func (RustFfiImpl) EchoRs

func (RustFfiImpl) EchoRs(req TBytes[*Ping]) RustFfiResult[Pong]

type RustFfiResult

type RustFfiResult[T any] struct {
	CBuffer
	Code ResultCode
	// contains filtered or unexported fields
}

RustFfiResult Rust FFI Result for Go NOTE: must call Free method to free rust memory buffer!

func (RustFfiResult[T]) AsError

func (r RustFfiResult[T]) AsError() error

AsError as an error NOTE: reference Rust memory buffer

func (RustFfiResult[T]) IsOk

func (r RustFfiResult[T]) IsOk() bool

func (RustFfiResult[T]) JsonUnmarshal

func (r RustFfiResult[T]) JsonUnmarshal() (*T, error)

JsonUnmarshal as json to unmarshal NOTE: maybe reference Rust memory buffer

func (RustFfiResult[T]) JsonUnmarshalUnchecked

func (r RustFfiResult[T]) JsonUnmarshalUnchecked() *T

JsonUnmarshalUnchecked as json to unmarshal NOTE: maybe reference Rust memory buffer

func (RustFfiResult[T]) PbUnmarshal

func (r RustFfiResult[T]) PbUnmarshal() (*T, error)

PbUnmarshal as protobuf to unmarshal NOTE: maybe reference Rust memory buffer

func (RustFfiResult[T]) PbUnmarshalUnchecked

func (r RustFfiResult[T]) PbUnmarshalUnchecked() *T

PbUnmarshalUnchecked as protobuf to unmarshal NOTE: maybe reference Rust memory buffer

func (RustFfiResult[T]) String

func (r RustFfiResult[T]) String() string

func (RustFfiResult[T]) Unmarshal

func (r RustFfiResult[T]) Unmarshal(unmarshal func([]byte, any) error) (*T, error)

Unmarshal unmarshal to object NOTE: maybe reference Rust memory buffer

func (RustFfiResult[T]) UnmarshalUnchecked

func (r RustFfiResult[T]) UnmarshalUnchecked(unmarshal func([]byte, any) error) *T

UnmarshalUnchecked unmarshal to object NOTE: maybe reference Rust memory buffer

type TBytes

type TBytes[T any] struct {
	// contains filtered or unexported fields
}

TBytes bytes with type marker

func TBytesFromBytes

func TBytesFromBytes[T any](bytes []byte) TBytes[T]

TBytesFromBytes new TBytes from bytes

func TBytesFromJson

func TBytesFromJson[T any](obj T) (TBytes[T], error)

func TBytesFromJsonUnchecked

func TBytesFromJsonUnchecked[T proto.Message](obj T) TBytes[T]

func TBytesFromPb

func TBytesFromPb[T proto.Message](obj T) (TBytes[T], error)

func TBytesFromPbUnchecked

func TBytesFromPbUnchecked[T proto.Message](obj T) TBytes[T]

func TBytesFromString

func TBytesFromString[T any](s string) TBytes[T]

TBytesFromString new TBytes from string

func (TBytes[T]) ForCBuffer

func (b TBytes[T]) ForCBuffer() (unsafe.Pointer, int)

func (TBytes[T]) JsonUnmarshal

func (b TBytes[T]) JsonUnmarshal() (*T, error)

JsonUnmarshal as json to unmarshal NOTE: maybe reference Rust memory buffer

func (TBytes[T]) JsonUnmarshalUnchecked

func (b TBytes[T]) JsonUnmarshalUnchecked() *T

JsonUnmarshalUnchecked as json to unmarshal NOTE: maybe reference Rust memory buffer

func (TBytes[T]) Len

func (b TBytes[T]) Len() int

func (TBytes[T]) PbUnmarshal

func (b TBytes[T]) PbUnmarshal() (*T, error)

PbUnmarshal as protobuf to unmarshal NOTE: maybe reference Rust memory buffer

func (TBytes[T]) PbUnmarshalUnchecked

func (b TBytes[T]) PbUnmarshalUnchecked() *T

PbUnmarshalUnchecked as protobuf to unmarshal NOTE: maybe reference Rust memory buffer

func (TBytes[T]) Unmarshal

func (b TBytes[T]) Unmarshal(unmarshal func([]byte, any) error) (*T, error)

Unmarshal unmarshal to object NOTE: maybe reference Rust memory buffer

func (TBytes[T]) UnmarshalUnchecked

func (b TBytes[T]) UnmarshalUnchecked(unmarshal func([]byte, any) error) *T

UnmarshalUnchecked unmarshal to object NOTE: maybe reference Rust memory buffer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL