Documentation ¶
Index ¶
- Constants
- Variables
- type Calculator
- type CalculatorAddArgs
- func (p *CalculatorAddArgs) GetNum1() int32
- func (p *CalculatorAddArgs) GetNum2() int32
- func (p *CalculatorAddArgs) Read(iprot thrift.TProtocol) error
- func (p *CalculatorAddArgs) ReadField1(iprot thrift.TProtocol) error
- func (p *CalculatorAddArgs) ReadField2(iprot thrift.TProtocol) error
- func (p *CalculatorAddArgs) String() string
- func (p *CalculatorAddArgs) Write(oprot thrift.TProtocol) error
- type CalculatorAddResult
- func (p *CalculatorAddResult) GetSuccess() int32
- func (p *CalculatorAddResult) IsSetSuccess() bool
- func (p *CalculatorAddResult) Read(iprot thrift.TProtocol) error
- func (p *CalculatorAddResult) ReadField0(iprot thrift.TProtocol) error
- func (p *CalculatorAddResult) String() string
- func (p *CalculatorAddResult) Write(oprot thrift.TProtocol) error
- type CalculatorCalculateArgs
- func (p *CalculatorCalculateArgs) GetLogid() int32
- func (p *CalculatorCalculateArgs) GetW() *Work
- func (p *CalculatorCalculateArgs) IsSetW() bool
- func (p *CalculatorCalculateArgs) Read(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateArgs) ReadField1(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateArgs) ReadField2(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateArgs) String() string
- func (p *CalculatorCalculateArgs) Write(oprot thrift.TProtocol) error
- type CalculatorCalculateResult
- func (p *CalculatorCalculateResult) GetOuch() *InvalidOperation
- func (p *CalculatorCalculateResult) GetSuccess() int32
- func (p *CalculatorCalculateResult) IsSetOuch() bool
- func (p *CalculatorCalculateResult) IsSetSuccess() bool
- func (p *CalculatorCalculateResult) Read(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateResult) ReadField0(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateResult) ReadField1(iprot thrift.TProtocol) error
- func (p *CalculatorCalculateResult) String() string
- func (p *CalculatorCalculateResult) Write(oprot thrift.TProtocol) error
- type CalculatorClient
- func (p *CalculatorClient) Add(ctx context.Context, num1 int32, num2 int32) (r int32, err error)
- func (p *CalculatorClient) Calculate(ctx context.Context, logid int32, w *Work) (r int32, err error)
- func (p *CalculatorClient) Ping(ctx context.Context) (err error)
- func (p *CalculatorClient) Zip(ctx context.Context) (err error)
- type CalculatorPingArgs
- type CalculatorPingResult
- type CalculatorProcessor
- type CalculatorZipArgs
- type InvalidOperation
- func (p *InvalidOperation) Error() string
- func (p *InvalidOperation) GetWhatOp() int32
- func (p *InvalidOperation) GetWhy() string
- func (p *InvalidOperation) Read(iprot thrift.TProtocol) error
- func (p *InvalidOperation) ReadField1(iprot thrift.TProtocol) error
- func (p *InvalidOperation) ReadField2(iprot thrift.TProtocol) error
- func (p *InvalidOperation) String() string
- func (p *InvalidOperation) Write(oprot thrift.TProtocol) error
- type MyInteger
- type Operation
- type Work
- func (p *Work) GetComment() string
- func (p *Work) GetNum1() int32
- func (p *Work) GetNum2() int32
- func (p *Work) GetOp() Operation
- func (p *Work) IsSetComment() bool
- func (p *Work) Read(iprot thrift.TProtocol) error
- func (p *Work) ReadField1(iprot thrift.TProtocol) error
- func (p *Work) ReadField2(iprot thrift.TProtocol) error
- func (p *Work) ReadField3(iprot thrift.TProtocol) error
- func (p *Work) ReadField4(iprot thrift.TProtocol) error
- func (p *Work) String() string
- func (p *Work) Write(oprot thrift.TProtocol) error
Constants ¶
const INT32CONSTANT = 9853
Variables ¶
var CalculatorAddResult_Success_DEFAULT int32
var CalculatorCalculateResult_Success_DEFAULT int32
var GoUnusedProtection__ int
var MAPCONSTANT map[string]string
var Work_Comment_DEFAULT string
Functions ¶
This section is empty.
Types ¶
type Calculator ¶
type Calculator interface { shared.SharedService // A method definition looks like C code. It has a return type, arguments, // and optionally a list of exceptions that it may throw. Note that argument // lists and exception lists are specified using the exact same syntax as // field lists in struct or exception definitions. Ping(ctx context.Context) (err error) // Parameters: // - Num1 // - Num2 Add(ctx context.Context, num1 int32, num2 int32) (r int32, err error) // Parameters: // - Logid // - W Calculate(ctx context.Context, logid int32, w *Work) (r int32, err error) // This method has a oneway modifier. That means the client only makes // a request and does not listen for any response at all. Oneway methods // must be void. Zip(ctx context.Context) (err error) }
type CalculatorAddArgs ¶
type CalculatorAddArgs struct { Num1 int32 `thrift:"num1,1" db:"num1" json:"num1"` Num2 int32 `thrift:"num2,2" db:"num2" json:"num2"` }
Attributes:
- Num1
- Num2
func NewCalculatorAddArgs ¶
func NewCalculatorAddArgs() *CalculatorAddArgs
func (*CalculatorAddArgs) GetNum1 ¶
func (p *CalculatorAddArgs) GetNum1() int32
func (*CalculatorAddArgs) GetNum2 ¶
func (p *CalculatorAddArgs) GetNum2() int32
func (*CalculatorAddArgs) ReadField1 ¶
func (p *CalculatorAddArgs) ReadField1(iprot thrift.TProtocol) error
func (*CalculatorAddArgs) ReadField2 ¶
func (p *CalculatorAddArgs) ReadField2(iprot thrift.TProtocol) error
func (*CalculatorAddArgs) String ¶
func (p *CalculatorAddArgs) String() string
type CalculatorAddResult ¶
type CalculatorAddResult struct {
Success *int32 `thrift:"success,0" db:"success" json:"success,omitempty"`
}
Attributes:
- Success
func NewCalculatorAddResult ¶
func NewCalculatorAddResult() *CalculatorAddResult
func (*CalculatorAddResult) GetSuccess ¶
func (p *CalculatorAddResult) GetSuccess() int32
func (*CalculatorAddResult) IsSetSuccess ¶
func (p *CalculatorAddResult) IsSetSuccess() bool
func (*CalculatorAddResult) ReadField0 ¶
func (p *CalculatorAddResult) ReadField0(iprot thrift.TProtocol) error
func (*CalculatorAddResult) String ¶
func (p *CalculatorAddResult) String() string
type CalculatorCalculateArgs ¶
type CalculatorCalculateArgs struct { Logid int32 `thrift:"logid,1" db:"logid" json:"logid"` W *Work `thrift:"w,2" db:"w" json:"w"` }
Attributes:
- Logid
- W
func NewCalculatorCalculateArgs ¶
func NewCalculatorCalculateArgs() *CalculatorCalculateArgs
func (*CalculatorCalculateArgs) GetLogid ¶
func (p *CalculatorCalculateArgs) GetLogid() int32
func (*CalculatorCalculateArgs) GetW ¶
func (p *CalculatorCalculateArgs) GetW() *Work
func (*CalculatorCalculateArgs) IsSetW ¶
func (p *CalculatorCalculateArgs) IsSetW() bool
func (*CalculatorCalculateArgs) Read ¶
func (p *CalculatorCalculateArgs) Read(iprot thrift.TProtocol) error
func (*CalculatorCalculateArgs) ReadField1 ¶
func (p *CalculatorCalculateArgs) ReadField1(iprot thrift.TProtocol) error
func (*CalculatorCalculateArgs) ReadField2 ¶
func (p *CalculatorCalculateArgs) ReadField2(iprot thrift.TProtocol) error
func (*CalculatorCalculateArgs) String ¶
func (p *CalculatorCalculateArgs) String() string
type CalculatorCalculateResult ¶
type CalculatorCalculateResult struct { Success *int32 `thrift:"success,0" db:"success" json:"success,omitempty"` Ouch *InvalidOperation `thrift:"ouch,1" db:"ouch" json:"ouch,omitempty"` }
Attributes:
- Success
- Ouch
func NewCalculatorCalculateResult ¶
func NewCalculatorCalculateResult() *CalculatorCalculateResult
func (*CalculatorCalculateResult) GetOuch ¶
func (p *CalculatorCalculateResult) GetOuch() *InvalidOperation
func (*CalculatorCalculateResult) GetSuccess ¶
func (p *CalculatorCalculateResult) GetSuccess() int32
func (*CalculatorCalculateResult) IsSetOuch ¶
func (p *CalculatorCalculateResult) IsSetOuch() bool
func (*CalculatorCalculateResult) IsSetSuccess ¶
func (p *CalculatorCalculateResult) IsSetSuccess() bool
func (*CalculatorCalculateResult) Read ¶
func (p *CalculatorCalculateResult) Read(iprot thrift.TProtocol) error
func (*CalculatorCalculateResult) ReadField0 ¶
func (p *CalculatorCalculateResult) ReadField0(iprot thrift.TProtocol) error
func (*CalculatorCalculateResult) ReadField1 ¶
func (p *CalculatorCalculateResult) ReadField1(iprot thrift.TProtocol) error
func (*CalculatorCalculateResult) String ¶
func (p *CalculatorCalculateResult) String() string
type CalculatorClient ¶
type CalculatorClient struct { // contains filtered or unexported fields }
Ahh, now onto the cool part, defining a service. Services just need a name and can optionally inherit from another service using the extends keyword.
func NewCalculatorClient ¶
func NewCalculatorClient(c thrift.TClient) *CalculatorClient
func NewCalculatorClientFactory
deprecated
func NewCalculatorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CalculatorClient
Deprecated: Use NewCalculator instead
func NewCalculatorClientProtocol
deprecated
func NewCalculatorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CalculatorClient
Deprecated: Use NewCalculator instead
func (*CalculatorClient) Calculate ¶
func (p *CalculatorClient) Calculate(ctx context.Context, logid int32, w *Work) (r int32, err error)
Parameters:
- Logid
- W
func (*CalculatorClient) Ping ¶
func (p *CalculatorClient) Ping(ctx context.Context) (err error)
A method definition looks like C code. It has a return type, arguments, and optionally a list of exceptions that it may throw. Note that argument lists and exception lists are specified using the exact same syntax as field lists in struct or exception definitions.
type CalculatorPingArgs ¶
type CalculatorPingArgs struct { }
func NewCalculatorPingArgs ¶
func NewCalculatorPingArgs() *CalculatorPingArgs
func (*CalculatorPingArgs) String ¶
func (p *CalculatorPingArgs) String() string
type CalculatorPingResult ¶
type CalculatorPingResult struct { }
func NewCalculatorPingResult ¶
func NewCalculatorPingResult() *CalculatorPingResult
func (*CalculatorPingResult) Read ¶
func (p *CalculatorPingResult) Read(iprot thrift.TProtocol) error
func (*CalculatorPingResult) String ¶
func (p *CalculatorPingResult) String() string
type CalculatorProcessor ¶
type CalculatorProcessor struct {
}func NewCalculatorProcessor ¶
func NewCalculatorProcessor(handler Calculator) *CalculatorProcessor
type CalculatorZipArgs ¶
type CalculatorZipArgs struct { }
func NewCalculatorZipArgs ¶
func NewCalculatorZipArgs() *CalculatorZipArgs
func (*CalculatorZipArgs) String ¶
func (p *CalculatorZipArgs) String() string
type InvalidOperation ¶
type InvalidOperation struct { WhatOp int32 `thrift:"whatOp,1" db:"whatOp" json:"whatOp"` Why string `thrift:"why,2" db:"why" json:"why"` }
Structs can also be exceptions, if they are nasty.
Attributes:
- WhatOp
- Why
var CalculatorCalculateResult_Ouch_DEFAULT *InvalidOperation
func NewInvalidOperation ¶
func NewInvalidOperation() *InvalidOperation
func (*InvalidOperation) Error ¶
func (p *InvalidOperation) Error() string
func (*InvalidOperation) GetWhatOp ¶
func (p *InvalidOperation) GetWhatOp() int32
func (*InvalidOperation) GetWhy ¶
func (p *InvalidOperation) GetWhy() string
func (*InvalidOperation) ReadField1 ¶
func (p *InvalidOperation) ReadField1(iprot thrift.TProtocol) error
func (*InvalidOperation) ReadField2 ¶
func (p *InvalidOperation) ReadField2(iprot thrift.TProtocol) error
func (*InvalidOperation) String ¶
func (p *InvalidOperation) String() string
type MyInteger ¶
type MyInteger int32
Thrift lets you do typedefs to get pretty names for your types. Standard C style here.
func MyIntegerPtr ¶
type Operation ¶
type Operation int64
You can define enums, which are just 32 bit integers. Values are optional and start at 1 if not supplied, C style again.
func OperationFromString ¶
func OperationPtr ¶
func (Operation) MarshalText ¶
func (*Operation) UnmarshalText ¶
type Work ¶
type Work struct { Num1 int32 `thrift:"num1,1" db:"num1" json:"num1"` Num2 int32 `thrift:"num2,2" db:"num2" json:"num2"` Op Operation `thrift:"op,3" db:"op" json:"op"` Comment *string `thrift:"comment,4" db:"comment" json:"comment,omitempty"` }
Structs are the basic complex data structures. They are comprised of fields which each have an integer identifier, a type, a symbolic name, and an optional default value.
Fields can be declared "optional", which ensures they will not be included in the serialized output if they aren't set. Note that this requires some manual management in some languages.
Attributes:
- Num1
- Num2
- Op
- Comment
var CalculatorCalculateArgs_W_DEFAULT *Work