Skip to content
🍩 turn thrift into Golang interfaces
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
algorithms
parser
template
thrift
.gitignore
Makefile
README.md
Thrift.g4
main.go

README.md

thrift to interface

Generate go interfaces for gomock testing from thrift files by Antlr4.

Examples

Run

thrift2interface -package=mypkg -prefix=prefix/ -thrift=./thrift/base.thrift

would output

// Code generated by thrift2interface. DO NOT EDIT.

package mypkg

import (
	"context"

	rootCommonStructStruct "prefix/thrift_gen/root_common/struct/struct"
)

type BaseOneInterface interface {
	ServiceOne(ctx context.Context) (err error)
	ServiceTwo(ctx context.Context, request *rootCommonStructStruct.XStruct) (err error)
	ServiceThree(ctx context.Context) (response *rootCommonStructStruct.YStruct, err error)
	ServiceFive(ctx context.Context, request *rootCommonStructStruct.XStruct) (response *rootCommonStructStruct.YStruct, err error)
	ServiceSeven(ctx context.Context) (err error)
	ServiceEleven(ctx context.Context, request *rootCommonStructStruct.XStruct) (err error)
}
You can’t perform that action at this time.