liupangzi / thrift2interface

🍩 turn thrift into Golang interfaces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)
}

About

🍩 turn thrift into Golang interfaces


Languages

Language:Go 97.6%Language:ANTLR 1.6%Language:Thrift 0.8%