Skip to content

liupangzi/thrift2interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thrift to interface

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

Examples

Run

thrift2interface -n=mypkg -p=prefix/ -t=./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)
}