tutorial

package
v0.0.0-...-c28da18 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2016 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const INT32CONSTANT = 9853

Variables

View Source
var AddResult_Success_DEFAULT int32
View Source
var CalculateResult_Success_DEFAULT int32
View Source
var GoUnusedProtection__ int
View Source
var MAPCONSTANT map[string]string
View Source
var Work_Comment_DEFAULT string

Functions

This section is empty.

Types

type AddArgs

type AddArgs struct {
	Num1 int32 `thrift:"num1,1" json:"num1"`
	Num2 int32 `thrift:"num2,2" json:"num2"`
}

func NewAddArgs

func NewAddArgs() *AddArgs

func (*AddArgs) GetNum1

func (p *AddArgs) GetNum1() int32

func (*AddArgs) GetNum2

func (p *AddArgs) GetNum2() int32

func (*AddArgs) Read

func (p *AddArgs) Read(iprot thrift.TProtocol) error

func (*AddArgs) ReadField1

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

func (*AddArgs) ReadField2

func (p *AddArgs) ReadField2(iprot thrift.TProtocol) error

func (*AddArgs) String

func (p *AddArgs) String() string

func (*AddArgs) Write

func (p *AddArgs) Write(oprot thrift.TProtocol) error

type AddResult

type AddResult struct {
	Success *int32 `thrift:"success,0" json:"success"`
}

func NewAddResult

func NewAddResult() *AddResult

func (*AddResult) GetSuccess

func (p *AddResult) GetSuccess() int32

func (*AddResult) IsSetSuccess

func (p *AddResult) IsSetSuccess() bool

func (*AddResult) Read

func (p *AddResult) Read(iprot thrift.TProtocol) error

func (*AddResult) ReadField0

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

func (*AddResult) String

func (p *AddResult) String() string

func (*AddResult) Write

func (p *AddResult) Write(oprot thrift.TProtocol) error

type CalculateArgs

type CalculateArgs struct {
	Logid int32 `thrift:"logid,1" json:"logid"`
	W     *Work `thrift:"w,2" json:"w"`
}

func NewCalculateArgs

func NewCalculateArgs() *CalculateArgs

func (*CalculateArgs) GetLogid

func (p *CalculateArgs) GetLogid() int32

func (*CalculateArgs) GetW

func (p *CalculateArgs) GetW() *Work

func (*CalculateArgs) IsSetW

func (p *CalculateArgs) IsSetW() bool

func (*CalculateArgs) Read

func (p *CalculateArgs) Read(iprot thrift.TProtocol) error

func (*CalculateArgs) ReadField1

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

func (*CalculateArgs) ReadField2

func (p *CalculateArgs) ReadField2(iprot thrift.TProtocol) error

func (*CalculateArgs) String

func (p *CalculateArgs) String() string

func (*CalculateArgs) Write

func (p *CalculateArgs) Write(oprot thrift.TProtocol) error

type CalculateResult

type CalculateResult struct {
	Success *int32            `thrift:"success,0" json:"success"`
	Ouch    *InvalidOperation `thrift:"ouch,1" json:"ouch"`
}

func NewCalculateResult

func NewCalculateResult() *CalculateResult

func (*CalculateResult) GetOuch

func (p *CalculateResult) GetOuch() *InvalidOperation

func (*CalculateResult) GetSuccess

func (p *CalculateResult) GetSuccess() int32

func (*CalculateResult) IsSetOuch

func (p *CalculateResult) IsSetOuch() bool

func (*CalculateResult) IsSetSuccess

func (p *CalculateResult) IsSetSuccess() bool

func (*CalculateResult) Read

func (p *CalculateResult) Read(iprot thrift.TProtocol) error

func (*CalculateResult) ReadField0

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

func (*CalculateResult) ReadField1

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

func (*CalculateResult) String

func (p *CalculateResult) String() string

func (*CalculateResult) Write

func (p *CalculateResult) Write(oprot thrift.TProtocol) error

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() (err error)
	// Parameters:
	//  - Num1
	//  - Num2
	Add(num1 int32, num2 int32) (r int32, err error)
	// Parameters:
	//  - Logid
	//  - W
	Calculate(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() (err error)
}

type CalculatorClient

type CalculatorClient struct {
	*shared.SharedServiceClient
}

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 NewCalculatorClientProtocol

func NewCalculatorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CalculatorClient

func (*CalculatorClient) Add

func (p *CalculatorClient) Add(num1 int32, num2 int32) (r int32, err error)

Parameters:

  • Num1
  • Num2

func (*CalculatorClient) Calculate

func (p *CalculatorClient) Calculate(logid int32, w *Work) (r int32, err error)

Parameters:

  • Logid
  • W

func (*CalculatorClient) Ping

func (p *CalculatorClient) Ping() (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.

func (*CalculatorClient) Zip

func (p *CalculatorClient) Zip() (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.

type CalculatorProcessor

type CalculatorProcessor struct {
	*shared.SharedServiceProcessor
}

func NewCalculatorProcessor

func NewCalculatorProcessor(handler Calculator) *CalculatorProcessor

type InvalidOperation

type InvalidOperation struct {
	WhatOp int32  `thrift:"whatOp,1" json:"whatOp"`
	Why    string `thrift:"why,2" json:"why"`
}
var CalculateResult_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) Read

func (p *InvalidOperation) Read(iprot thrift.TProtocol) error

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

func (*InvalidOperation) Write

func (p *InvalidOperation) Write(oprot thrift.TProtocol) error

type MyInteger

type MyInteger int32

Thrift lets you do typedefs to get pretty names for your types. Standard C style here.

func MyIntegerPtr

func MyIntegerPtr(v MyInteger) *MyInteger

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.

const (
	Operation_ADD      Operation = 1
	Operation_SUBTRACT Operation = 2
	Operation_MULTIPLY Operation = 3
	Operation_DIVIDE   Operation = 4
)

func OperationFromString

func OperationFromString(s string) (Operation, error)

func OperationPtr

func OperationPtr(v Operation) *Operation

func (Operation) String

func (p Operation) String() string

type PingArgs

type PingArgs struct {
}

func NewPingArgs

func NewPingArgs() *PingArgs

func (*PingArgs) Read

func (p *PingArgs) Read(iprot thrift.TProtocol) error

func (*PingArgs) String

func (p *PingArgs) String() string

func (*PingArgs) Write

func (p *PingArgs) Write(oprot thrift.TProtocol) error

type PingResult

type PingResult struct {
}

func NewPingResult

func NewPingResult() *PingResult

func (*PingResult) Read

func (p *PingResult) Read(iprot thrift.TProtocol) error

func (*PingResult) String

func (p *PingResult) String() string

func (*PingResult) Write

func (p *PingResult) Write(oprot thrift.TProtocol) error

type Work

type Work struct {
	Num1    int32     `thrift:"num1,1" json:"num1"`
	Num2    int32     `thrift:"num2,2" json:"num2"`
	Op      Operation `thrift:"op,3" json:"op"`
	Comment *string   `thrift:"comment,4" json:"comment"`
}
var CalculateArgs_W_DEFAULT *Work

func NewWork

func NewWork() *Work

func (*Work) GetComment

func (p *Work) GetComment() string

func (*Work) GetNum1

func (p *Work) GetNum1() int32

func (*Work) GetNum2

func (p *Work) GetNum2() int32

func (*Work) GetOp

func (p *Work) GetOp() Operation

func (*Work) IsSetComment

func (p *Work) IsSetComment() bool

func (*Work) Read

func (p *Work) Read(iprot thrift.TProtocol) error

func (*Work) ReadField1

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

func (*Work) ReadField2

func (p *Work) ReadField2(iprot thrift.TProtocol) error

func (*Work) ReadField3

func (p *Work) ReadField3(iprot thrift.TProtocol) error

func (*Work) ReadField4

func (p *Work) ReadField4(iprot thrift.TProtocol) error

func (*Work) String

func (p *Work) String() string

func (*Work) Write

func (p *Work) Write(oprot thrift.TProtocol) error

type ZipArgs

type ZipArgs struct {
}

func NewZipArgs

func NewZipArgs() *ZipArgs

func (*ZipArgs) Read

func (p *ZipArgs) Read(iprot thrift.TProtocol) error

func (*ZipArgs) String

func (p *ZipArgs) String() string

func (*ZipArgs) Write

func (p *ZipArgs) Write(oprot thrift.TProtocol) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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