├── .gitattributes ├── .gitignore ├── .travis.yml ├── ChangeLog.md ├── Gopkg.lock ├── Gopkg.toml ├── Jenkinsfile ├── LICENSE ├── README.md ├── README_en.md ├── b.bat ├── cmd ├── code.go ├── gen.go ├── help.go ├── init.go └── root.go ├── docs ├── ErrorHandling.md ├── ErrorHandling_en.md ├── dev_notes.md ├── markdown.md ├── markdown_en.md ├── protoapi_auth_cn.md ├── protoapi_auth_en.md ├── protoapi_auth_gen_example.md ├── protoapi_cli.md ├── protoapi_validation.md └── protoapi_验证.md ├── generator ├── data │ ├── data.go │ ├── proto_structs.go │ └── tpl │ │ └── tpl.go ├── generator.go ├── output │ ├── echo.go │ ├── echo_enum.go │ ├── echo_service.go │ ├── echo_struct.go │ ├── echo_v4.go │ ├── go.go │ ├── goclient.go │ ├── markdown.go │ ├── php_client.go │ ├── php_yii2.go │ ├── phpyii2 │ │ ├── controller.go │ │ ├── enum.go │ │ ├── error.go │ │ ├── handler.go │ │ ├── message.go │ │ ├── module.go │ │ └── php.go │ ├── spring.go │ ├── spring_service.go │ ├── spring_struct.go │ └── ts.go └── template │ ├── echo_enum.gogo │ ├── echo_service.gogo │ ├── echo_struct.gogo │ ├── echo_v4 │ └── service.gogo │ ├── go │ ├── enum.gogo │ ├── service.gogo │ └── struct.gogo │ ├── go_client.gogo │ ├── markdown.gomd │ ├── php_client.gophp │ ├── spring_service.gojava │ ├── spring_struct.gojava │ ├── ts │ ├── helper.gots │ ├── helper_common_partials.gots │ ├── helper_fetch.gots │ ├── objs.gots │ ├── service_axios.gots │ ├── service_fetch.gots │ └── service_wechat.gots │ └── yii2 │ ├── Module.gophp │ ├── RequestHandler.gophp │ ├── controllers │ └── ApiController.gophp │ ├── handlers │ ├── ErrorHandler.gophp │ └── RequestHandler.gophp │ └── models │ ├── enum.gophp │ ├── error.gophp │ └── message.gophp ├── go.mod ├── go.sum ├── main.go ├── main_test.go ├── notes.md ├── proto └── protoapi_common.proto ├── protoapigo └── json_api_binder.go ├── test ├── example.proto ├── expected │ ├── app │ │ └── modules │ │ │ └── todolist │ │ │ ├── Module.php │ │ │ ├── RequestHandler.php │ │ │ ├── controllers │ │ │ └── ApiController.php │ │ │ ├── handlers │ │ │ ├── ErrorHandler.php │ │ │ └── RequestHandler.php │ │ │ └── models │ │ │ ├── AddError.php │ │ │ ├── AddReq.php │ │ │ ├── AddResp.php │ │ │ ├── AuthError.php │ │ │ ├── BindError.php │ │ │ ├── Blank.php │ │ │ ├── FieldError.php │ │ │ ├── GenericError.php │ │ │ ├── ListResp.php │ │ │ ├── Todo.php │ │ │ ├── ValidateError.php │ │ │ └── ValidateErrorType.php │ ├── com │ │ └── yoozoo │ │ │ └── spring │ │ │ ├── AppServiceBase.java │ │ │ ├── AuthError.java │ │ │ ├── BindError.java │ │ │ ├── CommonError.java │ │ │ ├── Empty.java │ │ │ ├── Env.java │ │ │ ├── EnvListRequest.java │ │ │ ├── EnvListResponse.java │ │ │ ├── Error.java │ │ │ ├── FieldError.java │ │ │ ├── GenericError.java │ │ │ ├── KVHistoryItem.java │ │ │ ├── KVHistoryRequest.java │ │ │ ├── KVHistoryResponse.java │ │ │ ├── Key.java │ │ │ ├── KeyListRequest.java │ │ │ ├── KeyListResponse.java │ │ │ ├── KeyValue.java │ │ │ ├── KeyValueListRequest.java │ │ │ ├── KeyValueListResponse.java │ │ │ ├── KeyValueRequest.java │ │ │ ├── KeyValueResponse.java │ │ │ ├── Product.java │ │ │ ├── ProductListRequest.java │ │ │ ├── ProductListResponse.java │ │ │ ├── RegisterServiceRequest.java │ │ │ ├── RegisterServiceResponse.java │ │ │ ├── SearchKeyValueListRequest.java │ │ │ ├── Service.java │ │ │ ├── ServiceListRequest.java │ │ │ ├── ServiceListResponse.java │ │ │ ├── ServiceSearchRequest.java │ │ │ ├── Tag.java │ │ │ ├── TagListRequest.java │ │ │ ├── TagListResponse.java │ │ │ ├── UpdateServiceRequest.java │ │ │ ├── UpdateServiceResponse.java │ │ │ ├── UploadProtoFileRequest.java │ │ │ ├── UploadProtoFileResponse.java │ │ │ └── ValidateError.java │ ├── go │ │ ├── .keep │ │ ├── apisvr │ │ │ ├── AppServiceBase.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── Env.go │ │ │ ├── EnvListRequest.go │ │ │ ├── EnvListResponse.go │ │ │ ├── Error.go │ │ │ ├── ErrorCode.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── KVHistoryItem.go │ │ │ ├── KVHistoryRequest.go │ │ │ ├── KVHistoryResponse.go │ │ │ ├── Key.go │ │ │ ├── KeyListRequest.go │ │ │ ├── KeyListResponse.go │ │ │ ├── KeyValue.go │ │ │ ├── KeyValueListRequest.go │ │ │ ├── KeyValueListResponse.go │ │ │ ├── KeyValueRequest.go │ │ │ ├── KeyValueResponse.go │ │ │ ├── Product.go │ │ │ ├── ProductListRequest.go │ │ │ ├── ProductListResponse.go │ │ │ ├── RegisterServiceRequest.go │ │ │ ├── RegisterServiceResponse.go │ │ │ ├── SearchKeyValueListRequest.go │ │ │ ├── Service.go │ │ │ ├── ServiceListRequest.go │ │ │ ├── ServiceListResponse.go │ │ │ ├── ServiceSearchRequest.go │ │ │ ├── Tag.go │ │ │ ├── TagListRequest.go │ │ │ ├── TagListResponse.go │ │ │ ├── UpdateServiceRequest.go │ │ │ ├── UpdateServiceResponse.go │ │ │ ├── UploadProtoFileRequest.go │ │ │ ├── UploadProtoFileResponse.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ ├── calcsvr │ │ │ ├── AddError.go │ │ │ ├── AddReq.go │ │ │ ├── AddResp.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CalcServiceBase.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── ExtendCalcServiceBase.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ ├── echosvr │ │ │ ├── EchoServiceBase.go │ │ │ └── Msg.go │ │ ├── nested │ │ │ ├── AddError.go │ │ │ ├── AddReq.go │ │ │ ├── AddResp.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CalcServiceBase.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── Extra.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ └── todolistsvr │ │ │ ├── AddError.go │ │ │ ├── AddReq.go │ │ │ ├── AddResp.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ListResp.go │ │ │ ├── Todo.go │ │ │ ├── TodolistServiceBase.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ ├── markdown │ │ └── LoginService.md │ ├── package │ │ └── go │ │ │ ├── .keep │ │ │ ├── calc │ │ │ └── AddReq.go │ │ │ ├── calcsvr │ │ │ └── AddReq.go │ │ │ ├── calcsvrmain │ │ │ ├── AddError.go │ │ │ ├── AddReq.go │ │ │ ├── AddResp.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CalcServiceBase.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ │ ├── calcsvrmain_without │ │ │ ├── AddError.go │ │ │ ├── AddReq.go │ │ │ ├── AddResp.go │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CalcServiceBase.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ │ ├── common │ │ │ ├── AuthError.go │ │ │ ├── BindError.go │ │ │ ├── CommonError.go │ │ │ ├── Empty.go │ │ │ ├── FieldError.go │ │ │ ├── GenericError.go │ │ │ ├── ValidateError.go │ │ │ └── ValidateErrorType.go │ │ │ └── github.com │ │ │ └── yoozoo │ │ │ └── protoapi │ │ │ └── calcsvr │ │ │ └── AddReq.go │ ├── ts │ │ ├── .keep │ │ ├── AppService.ts │ │ ├── AppServiceObjs.ts │ │ ├── axios │ │ │ ├── .keep │ │ │ ├── AppService.ts │ │ │ ├── AppServiceObjs.ts │ │ │ └── helper.ts │ │ ├── fetch │ │ │ ├── .keep │ │ │ ├── AppService.ts │ │ │ ├── AppServiceObjs.ts │ │ │ └── helper.ts │ │ ├── helper.ts │ │ └── wechat │ │ │ ├── .keep │ │ │ ├── AppService.ts │ │ │ ├── AppServiceObjs.ts │ │ │ └── helper.ts │ └── yoozoo.protoconf.ts │ │ └── AppService.php ├── proto │ ├── calc.proto │ ├── common.proto │ ├── confusion.proto │ ├── confusion2.proto │ ├── echo.proto │ ├── login.proto │ ├── nested.proto │ ├── package │ │ ├── common.proto │ │ ├── gopackage_addReq.proto │ │ ├── gopackage_addReqFull.proto │ │ ├── gopackage_calc.proto │ │ ├── gopackage_calcFull.proto │ │ ├── gopackage_calc_warn.proto │ │ ├── mixpackage_addReq.proto │ │ ├── mixpackage_calc.proto │ │ ├── nopackage_addReq.proto │ │ ├── nopackage_calc.proto │ │ ├── nopackage_calc_warn.proto │ │ ├── package_addReq.proto │ │ ├── package_calc._without_commonerror.proto │ │ ├── package_calc.proto │ │ └── package_calc_commonerror.proto │ ├── test.proto │ └── todolist.proto ├── result │ ├── go │ │ └── .keep │ ├── package │ │ └── go │ │ │ └── .keep │ └── ts │ │ ├── .keep │ │ ├── axios │ │ └── .keep │ │ ├── fetch │ │ └── .keep │ │ └── wechat │ │ └── .keep ├── simple.proto ├── test_calc.go ├── test_echo.go └── test_todolist.go ├── util ├── error.go ├── include_files.go ├── misc.go ├── protoapi_include.go └── protoc_setting.go └── vendor ├── github.com ├── golang │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── proto │ │ ├── clone.go │ │ ├── decode.go │ │ ├── discard.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── table_marshal.go │ │ ├── table_merge.go │ │ ├── table_unmarshal.go │ │ ├── text.go │ │ └── text_parser.go │ │ └── protoc-gen-go │ │ ├── descriptor │ │ ├── descriptor.pb.go │ │ └── descriptor.proto │ │ └── plugin │ │ ├── plugin.pb.go │ │ ├── plugin.pb.golden │ │ └── plugin.proto ├── inconshreveable │ └── mousetrap │ │ ├── LICENSE │ │ ├── README.md │ │ ├── trap_others.go │ │ ├── trap_windows.go │ │ └── trap_windows_1.4.go ├── mattn │ ├── go-colorable │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── colorable_appengine.go │ │ ├── colorable_others.go │ │ ├── colorable_windows.go │ │ └── noncolorable.go │ └── go-isatty │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_linux_ppc64x.go │ │ ├── isatty_others.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── spf13 │ ├── cobra │ │ ├── .gitignore │ │ ├── .mailmap │ │ ├── .travis.yml │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── args.go │ │ ├── bash_completions.go │ │ ├── bash_completions.md │ │ ├── cobra.go │ │ ├── cobra │ │ │ └── cmd │ │ │ │ └── testdata │ │ │ │ └── LICENSE.golden │ │ ├── command.go │ │ ├── command_notwin.go │ │ ├── command_win.go │ │ └── zsh_completions.go │ └── pflag │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bool.go │ │ ├── bool_slice.go │ │ ├── bytes.go │ │ ├── count.go │ │ ├── duration.go │ │ ├── duration_slice.go │ │ ├── flag.go │ │ ├── float32.go │ │ ├── float64.go │ │ ├── golangflag.go │ │ ├── int.go │ │ ├── int16.go │ │ ├── int32.go │ │ ├── int64.go │ │ ├── int8.go │ │ ├── int_slice.go │ │ ├── ip.go │ │ ├── ip_slice.go │ │ ├── ipmask.go │ │ ├── ipnet.go │ │ ├── string.go │ │ ├── string_array.go │ │ ├── string_slice.go │ │ ├── uint.go │ │ ├── uint16.go │ │ ├── uint32.go │ │ ├── uint64.go │ │ ├── uint8.go │ │ └── uint_slice.go └── valyala │ ├── bytebufferpool │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── bytebuffer.go │ ├── doc.go │ └── pool.go │ └── fasttemplate │ ├── LICENSE │ ├── README.md │ ├── template.go │ ├── unsafe.go │ └── unsafe_gae.go └── golang.org └── x ├── crypto ├── AUTHORS ├── CONTRIBUTORS ├── LICENSE ├── PATENTS └── acme │ ├── acme.go │ ├── autocert │ ├── autocert.go │ ├── cache.go │ ├── listener.go │ └── renewal.go │ ├── http.go │ ├── jws.go │ └── types.go └── sys ├── AUTHORS ├── CONTRIBUTORS ├── LICENSE ├── PATENTS └── unix ├── .gitignore ├── README.md ├── affinity_linux.go ├── aliases.go ├── asm_darwin_386.s ├── asm_darwin_amd64.s ├── asm_darwin_arm.s ├── asm_darwin_arm64.s ├── asm_dragonfly_amd64.s ├── asm_freebsd_386.s ├── asm_freebsd_amd64.s ├── asm_freebsd_arm.s ├── asm_linux_386.s ├── asm_linux_amd64.s ├── asm_linux_arm.s ├── asm_linux_arm64.s ├── asm_linux_mips64x.s ├── asm_linux_mipsx.s ├── asm_linux_ppc64x.s ├── asm_linux_s390x.s ├── asm_netbsd_386.s ├── asm_netbsd_amd64.s ├── asm_netbsd_arm.s ├── asm_openbsd_386.s ├── asm_openbsd_amd64.s ├── asm_openbsd_arm.s ├── asm_solaris_amd64.s ├── bluetooth_linux.go ├── cap_freebsd.go ├── constants.go ├── dev_aix_ppc.go ├── dev_aix_ppc64.go ├── dev_darwin.go ├── dev_dragonfly.go ├── dev_freebsd.go ├── dev_linux.go ├── dev_netbsd.go ├── dev_openbsd.go ├── dirent.go ├── endian_big.go ├── endian_little.go ├── env_unix.go ├── errors_freebsd_386.go ├── errors_freebsd_amd64.go ├── errors_freebsd_arm.go ├── fcntl.go ├── fcntl_linux_32bit.go ├── gccgo.go ├── gccgo_c.c ├── gccgo_linux_amd64.go ├── ioctl.go ├── mkall.sh ├── mkerrors.sh ├── mkpost.go ├── mksyscall.pl ├── mksyscall_aix.pl ├── mksyscall_solaris.pl ├── mksysctl_openbsd.pl ├── mksysnum_darwin.pl ├── mksysnum_dragonfly.pl ├── mksysnum_freebsd.pl ├── mksysnum_netbsd.pl ├── mksysnum_openbsd.pl ├── openbsd_pledge.go ├── pagesize_unix.go ├── race.go ├── race0.go ├── sockcmsg_linux.go ├── sockcmsg_unix.go ├── str.go ├── syscall.go ├── syscall_aix.go ├── syscall_aix_ppc.go ├── syscall_aix_ppc64.go ├── syscall_bsd.go ├── syscall_darwin.go ├── syscall_darwin_386.go ├── syscall_darwin_amd64.go ├── syscall_darwin_arm.go ├── syscall_darwin_arm64.go ├── syscall_dragonfly.go ├── syscall_dragonfly_amd64.go ├── syscall_freebsd.go ├── syscall_freebsd_386.go ├── syscall_freebsd_amd64.go ├── syscall_freebsd_arm.go ├── syscall_linux.go ├── syscall_linux_386.go ├── syscall_linux_amd64.go ├── syscall_linux_amd64_gc.go ├── syscall_linux_arm.go ├── syscall_linux_arm64.go ├── syscall_linux_gc.go ├── syscall_linux_gc_386.go ├── syscall_linux_gccgo_386.go ├── syscall_linux_gccgo_arm.go ├── syscall_linux_mips64x.go ├── syscall_linux_mipsx.go ├── syscall_linux_ppc64x.go ├── syscall_linux_s390x.go ├── syscall_linux_sparc64.go ├── syscall_netbsd.go ├── syscall_netbsd_386.go ├── syscall_netbsd_amd64.go ├── syscall_netbsd_arm.go ├── syscall_openbsd.go ├── syscall_openbsd_386.go ├── syscall_openbsd_amd64.go ├── syscall_openbsd_arm.go ├── syscall_solaris.go ├── syscall_solaris_amd64.go ├── syscall_unix.go ├── syscall_unix_gc.go ├── timestruct.go ├── types_aix.go ├── types_darwin.go ├── types_dragonfly.go ├── types_freebsd.go ├── types_netbsd.go ├── types_openbsd.go ├── types_solaris.go ├── xattr_bsd.go ├── zerrors_aix_ppc.go ├── zerrors_aix_ppc64.go ├── zerrors_darwin_386.go ├── zerrors_darwin_amd64.go ├── zerrors_darwin_arm.go ├── zerrors_darwin_arm64.go ├── zerrors_dragonfly_amd64.go ├── zerrors_freebsd_386.go ├── zerrors_freebsd_amd64.go ├── zerrors_freebsd_arm.go ├── zerrors_linux_386.go ├── zerrors_linux_amd64.go ├── zerrors_linux_arm.go ├── zerrors_linux_arm64.go ├── zerrors_linux_mips.go ├── zerrors_linux_mips64.go ├── zerrors_linux_mips64le.go ├── zerrors_linux_mipsle.go ├── zerrors_linux_ppc64.go ├── zerrors_linux_ppc64le.go ├── zerrors_linux_s390x.go ├── zerrors_linux_sparc64.go ├── zerrors_netbsd_386.go ├── zerrors_netbsd_amd64.go ├── zerrors_netbsd_arm.go ├── zerrors_openbsd_386.go ├── zerrors_openbsd_amd64.go ├── zerrors_openbsd_arm.go ├── zerrors_solaris_amd64.go ├── zptrace386_linux.go ├── zptracearm_linux.go ├── zptracemips_linux.go ├── zptracemipsle_linux.go ├── zsyscall_aix_ppc.go ├── zsyscall_aix_ppc64.go ├── zsyscall_darwin_386.go ├── zsyscall_darwin_amd64.go ├── zsyscall_darwin_arm.go ├── zsyscall_darwin_arm64.go ├── zsyscall_dragonfly_amd64.go ├── zsyscall_freebsd_386.go ├── zsyscall_freebsd_amd64.go ├── zsyscall_freebsd_arm.go ├── zsyscall_linux_386.go ├── zsyscall_linux_amd64.go ├── zsyscall_linux_arm.go ├── zsyscall_linux_arm64.go ├── zsyscall_linux_mips.go ├── zsyscall_linux_mips64.go ├── zsyscall_linux_mips64le.go ├── zsyscall_linux_mipsle.go ├── zsyscall_linux_ppc64.go ├── zsyscall_linux_ppc64le.go ├── zsyscall_linux_s390x.go ├── zsyscall_linux_sparc64.go ├── zsyscall_netbsd_386.go ├── zsyscall_netbsd_amd64.go ├── zsyscall_netbsd_arm.go ├── zsyscall_openbsd_386.go ├── zsyscall_openbsd_amd64.go ├── zsyscall_openbsd_arm.go ├── zsyscall_solaris_amd64.go ├── zsysctl_openbsd_386.go ├── zsysctl_openbsd_amd64.go ├── zsysctl_openbsd_arm.go ├── zsysnum_darwin_386.go ├── zsysnum_darwin_amd64.go ├── zsysnum_darwin_arm.go ├── zsysnum_darwin_arm64.go ├── zsysnum_dragonfly_amd64.go ├── zsysnum_freebsd_386.go ├── zsysnum_freebsd_amd64.go ├── zsysnum_freebsd_arm.go ├── zsysnum_linux_386.go ├── zsysnum_linux_amd64.go ├── zsysnum_linux_arm.go ├── zsysnum_linux_arm64.go ├── zsysnum_linux_mips.go ├── zsysnum_linux_mips64.go ├── zsysnum_linux_mips64le.go ├── zsysnum_linux_mipsle.go ├── zsysnum_linux_ppc64.go ├── zsysnum_linux_ppc64le.go ├── zsysnum_linux_s390x.go ├── zsysnum_linux_sparc64.go ├── zsysnum_netbsd_386.go ├── zsysnum_netbsd_amd64.go ├── zsysnum_netbsd_arm.go ├── zsysnum_openbsd_386.go ├── zsysnum_openbsd_amd64.go ├── zsysnum_openbsd_arm.go ├── ztypes_aix_ppc.go ├── ztypes_aix_ppc64.go ├── ztypes_darwin_386.go ├── ztypes_darwin_amd64.go ├── ztypes_darwin_arm.go ├── ztypes_darwin_arm64.go ├── ztypes_dragonfly_amd64.go ├── ztypes_freebsd_386.go ├── ztypes_freebsd_amd64.go ├── ztypes_freebsd_arm.go ├── ztypes_linux_386.go ├── ztypes_linux_amd64.go ├── ztypes_linux_arm.go ├── ztypes_linux_arm64.go ├── ztypes_linux_mips.go ├── ztypes_linux_mips64.go ├── ztypes_linux_mips64le.go ├── ztypes_linux_mipsle.go ├── ztypes_linux_ppc64.go ├── ztypes_linux_ppc64le.go ├── ztypes_linux_s390x.go ├── ztypes_linux_sparc64.go ├── ztypes_netbsd_386.go ├── ztypes_netbsd_amd64.go ├── ztypes_netbsd_arm.go ├── ztypes_openbsd_386.go ├── ztypes_openbsd_amd64.go ├── ztypes_openbsd_arm.go └── ztypes_solaris_amd64.go /.gitattributes: -------------------------------------------------------------------------------- 1 | generator/template/**/* text eol=lf 2 | generator/template/* text eol=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | test/result/ 2 | *.exe 3 | protoapi 4 | .gradle 5 | .idea 6 | build 7 | out 8 | /bin 9 | .classpath 10 | .project 11 | .settings 12 | tmp/ 13 | .vscode/ 14 | *.gob 15 | *.out 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.10" 4 | - "1.12.4" 5 | install: 6 | - go get -v 7 | - go get github.com/sergi/go-diff/diffmatchpatch 8 | before_script: 9 | - go build -v 10 | - ./protoapi init 11 | - export PROTOAPI_EXE=$(pwd)/protoapi 12 | script: 13 | - go test 14 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # ChangeLog | 版本发布 2 | 3 | # 0.1.1 4 | * 提供开源版本至github 5 | 6 | # 0.1.0 7 | * 支持生成API相关的前端Vue和ts代码,客戶端php代碼 8 | * 支持生成后端Java(spring)和go (echo)的代码 9 | * [错误处理规范](https://github.com/yoozoo/protoapi/blob/master/docs/ErrorHandling.md) 10 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://golang.github.io/dep/docs/Gopkg.toml.html 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | ignored = ["github.com/labstack/echo"] 28 | 29 | [[constraint]] 30 | name = "github.com/golang/protobuf" 31 | version = "1.2.0" 32 | 33 | [prune] 34 | go-tests = true 35 | unused-packages = true 36 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | node { 2 | ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}") { 3 | env.GOPATH=pwd() 4 | dir('src/github.com/yoozoo/protoapi') { 5 | stage('Checkout'){ 6 | checkout scm 7 | } 8 | stage('Pre Build'){ 9 | sh 'go get -u github.com/golang/dep/cmd/dep' 10 | sh '${GOPATH}/bin/dep ensure' 11 | } 12 | stage('Build'){ 13 | sh """go build""" 14 | } 15 | stage('Test'){ 16 | echo 'Testing' 17 | dir('test') { 18 | sh """mkdir result && ./protoapi.bats""" 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 yoozoo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /b.bat: -------------------------------------------------------------------------------- 1 | .\protoapi.exe gen test\result\go\ test\proto\test.proto --lang=go 2 | .\protoapi.exe gen test\result\go\ test\proto\echo.proto --lang=go 3 | .\protoapi.exe gen test\result\ts\ test\proto\echo.proto --lang=ts 4 | .\protoapi.exe gen test\result\go\ test\proto\calc.proto --lang=go 5 | .\protoapi.exe gen test\result\go\ test\proto\todolist.proto --lang=go 6 | REM .\protoapi.exe gen test\result\ts\ test\proto\test.proto --lang=ts 7 | REM .\protoapi.exe gen test\result\ts\fetch test\proto\test.proto --lang=ts-fetch 8 | REM .\protoapi.exe gen test\result\ts\axios test\proto\test.proto --lang=ts-axios 9 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | // RootCmd represents the base command when called without any subcommands 11 | var RootCmd = &cobra.Command{ 12 | Use: "protoapi", 13 | Short: "protoapi is a code generation command line tool", 14 | Long: `protoapi is a tool/document to help generate API code: 15 | 1. as a IDL, to document API request/response and function for developers' reference; 16 | 2. generate boilderplate code to save time and cost for developers`, 17 | Version: "0.1.1", 18 | } 19 | 20 | // Execute adds all child commands to the root command and sets flags appropriately. 21 | // This is called by main.main(). It only needs to happen once to the RootCmd. 22 | func Execute() { 23 | if err := RootCmd.Execute(); err != nil { 24 | fmt.Println(err) 25 | os.Exit(1) 26 | } 27 | } 28 | 29 | func init() { 30 | RootCmd.SetUsageFunc(usageFunc) 31 | RootCmd.SetHelpTemplate(`{{.UsageString}}`) 32 | } 33 | -------------------------------------------------------------------------------- /docs/dev_notes.md: -------------------------------------------------------------------------------- 1 | * Should refactor generator with proto_structs completely 2 | * Document best practise for adding new gen 3 | * Review test cases 4 | 5 | -------------------------------------------------------------------------------- /docs/protoapi_cli.md: -------------------------------------------------------------------------------- 1 | # protoapi CLI 2 | 3 | protoapi command line tool 4 | 5 | ## First time use 6 | 7 | Please run init command to initialize 8 | 9 | ```bash 10 | protoapi init 11 | ``` 12 | 13 | ## Support commands 14 | 15 | * root 16 | * init 17 | * gen 18 | * help 19 | 20 | ## root command 21 | 22 | root command will display help information. 23 | 24 | ## init command 25 | 26 | init command will download protoc and other required files into your home directory. 27 | 28 | ## gen command 29 | 30 | gen command will generate user declared language/framework code including API interface and request/response. 31 | 32 | To run gen command, use: 33 | 34 | ```bash 35 | protoapi gen --lang=[language] [output directory] [proto file] 36 | ``` 37 | -------------------------------------------------------------------------------- /generator/output/echo_enum.go: -------------------------------------------------------------------------------- 1 | package output 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/yoozoo/protoapi/generator/data" 7 | ) 8 | 9 | type echoEnumField struct { 10 | data.EnumField 11 | } 12 | 13 | func newEchoEnum(enum *data.EnumData, packageName string) *echoEnum { 14 | ss := strings.Split(packageName, "/") 15 | s := ss[len(ss)-1] 16 | o := &echoEnum{ 17 | enum, 18 | s, 19 | nil, 20 | } 21 | o.init() 22 | return o 23 | } 24 | 25 | type echoEnum struct { 26 | *data.EnumData 27 | Package string 28 | Fields []*echoEnumField 29 | } 30 | 31 | func (s *echoEnum) init() { 32 | s.Fields = make([]*echoEnumField, len(s.EnumData.Fields)) 33 | for i, f := range s.EnumData.Fields { 34 | s.Fields[i] = &echoEnumField{f} 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /generator/output/echo_v4.go: -------------------------------------------------------------------------------- 1 | package output 2 | 3 | import ( 4 | "github.com/yoozoo/protoapi/generator/data" 5 | ) 6 | 7 | type echoV4Gen struct { 8 | goGen 9 | } 10 | 11 | func (g *echoV4Gen) Gen(applicationName string, packageName string, services []*data.ServiceData, messages []*data.MessageData, enums []*data.EnumData, options data.OptionMap) (result map[string]string, err error) { 12 | g.DataTypes = messages 13 | serviceResult := make(map[string]string) 14 | for _, service := range services { 15 | g.serviceTpl = g.getTpl("/generator/template/echo_v4/service.gogo") 16 | serviceContent := g.genGoService(service) 17 | serviceFilename := genEchoFileName(g.PackageName, service) 18 | g.serviceTpl = nil 19 | serviceResult[serviceFilename] = serviceContent 20 | } 21 | 22 | result, err = g.echoGen.Gen(applicationName, packageName, services, messages, enums, options) 23 | for k, v := range serviceResult { 24 | result[k] = v 25 | } 26 | 27 | return 28 | } 29 | 30 | func init() { 31 | data.OutputMap["echo_v4"] = &echoV4Gen{} 32 | } 33 | -------------------------------------------------------------------------------- /generator/output/phpyii2/php.go: -------------------------------------------------------------------------------- 1 | package phpyii2 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/yoozoo/protoapi/generator/data" 7 | ) 8 | 9 | //GetPHPClassName rename class to valid php class name 10 | func getPHPClassName(old string) string { 11 | if strings.ToUpper(old) == "EMPTY" { 12 | return "Blank" 13 | } 14 | switch old { 15 | case data.IntFieldType: 16 | return "int" 17 | case data.BooleanFieldType: 18 | return "boolean" 19 | case data.StringFieldType: 20 | return "string" 21 | case data.DoubleFieldType: 22 | return "double" 23 | default: 24 | return strings.Title(old) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /generator/output/spring_service.go: -------------------------------------------------------------------------------- 1 | package output 2 | 3 | import ( 4 | "github.com/yoozoo/protoapi/generator/data" 5 | ) 6 | 7 | type springMethod struct { 8 | *data.Method 9 | ServiceName string 10 | } 11 | 12 | func (m *springMethod) Path() string { 13 | return "/" + m.ServiceName + "." + m.Name 14 | } 15 | 16 | func (m *springMethod) ServiceType() string { 17 | if servType, ok := m.Options[data.MethodOptions[data.ServiceTypeMethodOption].Name]; ok { 18 | return servType 19 | } 20 | 21 | return "POST" 22 | } 23 | 24 | type springService struct { 25 | *data.ServiceData 26 | Package string 27 | Methods []*springMethod 28 | } 29 | 30 | func newSpringService(msg *data.ServiceData, packageName string) *springService { 31 | o := &springService{ 32 | msg, 33 | packageName, 34 | nil, 35 | } 36 | o.init() 37 | return o 38 | } 39 | 40 | func (s *springService) init() { 41 | s.Methods = make([]*springMethod, len(s.ServiceData.Methods)) 42 | for i, f := range s.ServiceData.Methods { 43 | mtd := f 44 | s.Methods[i] = &springMethod{mtd, s.Name} 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /generator/template/echo_enum.gogo: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package {{.Package}} 4 | 5 | type {{.Name}} int 6 | 7 | const ( 8 | {{- range .Fields }} 9 | {{.Name}} {{$.Name}} = {{.Value}} 10 | {{- end}} 11 | ) 12 | 13 | func (code {{.Name}}) String() string { 14 | names := map[{{.Name}}]string{ 15 | {{- range .Fields }} 16 | {{.Name}}: "{{.Name}}", 17 | {{- end}} 18 | } 19 | 20 | return names[code] 21 | } 22 | 23 | func (code {{.Name}}) Code() int { 24 | return (int)(code) 25 | } 26 | {{- range .Fields }} 27 | 28 | func (code {{$.Name}}) Is{{.Name}}() bool { 29 | return code == {{.Name}} 30 | } 31 | {{- end }} 32 | -------------------------------------------------------------------------------- /generator/template/echo_struct.gogo: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package {{.Package}} 4 | 5 | // {{.ClassName}} 6 | type {{.ClassName}} struct { 7 | {{- range .Fields }} 8 | {{.Title}} {{.Type}} `json:"{{.Name}}"` 9 | {{- end }} 10 | } 11 | {{- range .Fields }} 12 | 13 | func (r *{{$.ClassName}}) Get{{.Title}}() {{.Type}} { 14 | if r == nil { 15 | var zeroVal {{.Type}} 16 | return zeroVal 17 | } 18 | return r.{{.Title}} 19 | } 20 | {{- end }} 21 | 22 | func (r {{.ClassName}}) Validate() *ValidateError { 23 | errs := []*FieldError{} 24 | {{- range .Fields }} 25 | {{- if .ValidateRequired }} 26 | if r.{{.Title}} == "" { 27 | e := FIELD_REQUIRED 28 | errs = append(errs, &FieldError{FieldName: r.{{.Title}}, ErrorType: &e}) 29 | } 30 | {{- end }} 31 | {{- if eq .ValidateFormat "email" }} 32 | if !rxEmail.MatchString(r.{{.Title}}) { 33 | e := INVALID_EMAIL 34 | errs = append(errs, &FieldError{FieldName: r.{{.Title}}, ErrorType: &e}) 35 | } 36 | {{- end }} 37 | {{- end }} 38 | if len(errs) > 0 { 39 | return &ValidateError{Errors: errs} 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /generator/template/go/enum.gogo: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package {{.Package}} 4 | 5 | type {{.Name}} int 6 | 7 | const ( 8 | {{- range .Fields }} 9 | {{.Name}} {{$.Name}} = {{.Value}} 10 | {{- end}} 11 | ) 12 | 13 | func (code {{.Name}}) String() string { 14 | names := map[{{.Name}}]string{ 15 | {{- range .Fields }} 16 | {{.Name}}: "{{.Name}}", 17 | {{- end}} 18 | } 19 | 20 | return names[code] 21 | } 22 | 23 | func (code {{.Name}}) Code() int { 24 | return (int)(code) 25 | } 26 | {{- range .Fields }} 27 | 28 | func (code {{$.Name}}) Is{{.Name}}() bool { 29 | return code == {{.Name}} 30 | } 31 | {{- end }} 32 | -------------------------------------------------------------------------------- /generator/template/spring_service.gojava: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package {{.Package}}; 4 | 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | 10 | public abstract class {{.Name}}Base { 11 | {{- range .Methods }} 12 | {{- if ne .ServiceType "GET" }} 13 | @PostMapping("{{.Path}}") 14 | @ResponseBody 15 | public {{.OutputType}} {{.Name}}Post(@RequestBody {{.InputType}} in) { 16 | return {{.Name}}(in); 17 | } 18 | {{- end }} 19 | 20 | {{- if ne .ServiceType "POST" }} 21 | @GetMapping("{{.Path}}") 22 | @ResponseBody 23 | public {{.OutputType}} {{.Name}}Get({{.InputType}} in) { 24 | return {{.Name}}(in); 25 | } 26 | {{- end }} 27 | 28 | abstract {{.OutputType}} {{.Name}}({{.InputType}} in); 29 | {{ end }} 30 | } 31 | -------------------------------------------------------------------------------- /generator/template/spring_struct.gojava: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package {{.Package}}; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class {{.ClassName}} { 11 | {{- range .Fields}} 12 | private final {{.JavaType}} {{ .Name }}; 13 | {{- end }} 14 | 15 | @JsonCreator 16 | public {{.ClassName}}({{.ContructParam}}) { 17 | {{- range .Fields}} 18 | this.{{ .Name }} = {{ .Name }}; 19 | {{- end }} 20 | } 21 | 22 | {{range .Fields -}} 23 | public {{.JavaType}} get{{ .Title }}() { 24 | return {{ .Name }}; 25 | } 26 | {{ end }} 27 | } 28 | -------------------------------------------------------------------------------- /generator/template/ts/helper.gots: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * @param {response} response the error response 5 | */ 6 | export function errorHandling(err): Promise { 7 | if(!err || err.response === undefined) { 8 | return Promise.reject(err); 9 | } 10 | let data; 11 | try { 12 | data = JSON.parse(err.response.data); 13 | } catch (e) { 14 | data = err.response.data; 15 | } 16 | switch (err.response.status) { 17 | case httpCode.BIZ_ERROR: 18 | return Promise.reject({...err, message: data.message}); 19 | {{if .Gen.HasCommonError}} 20 | case httpCode.COMMON_ERROR: 21 | let returnErr = mapCommonErrorType(data); 22 | if(!returnErr){ 23 | throw err 24 | } 25 | return Promise.reject({...err.response, ...returnErr}); 26 | default: 27 | return Promise.reject(err); 28 | {{end}} 29 | } 30 | } -------------------------------------------------------------------------------- /generator/template/ts/helper_fetch.gots: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * @param {response} response the error response 5 | */ 6 | export async function errorHandling(error): Promise { 7 | if(!error) { 8 | return error 9 | } 10 | if (!!error.data && typeof error.data === 'object') { 11 | if (error.data.message) { 12 | error.message = error.data.message 13 | } 14 | switch (error.status) { 15 | case httpCode.BIZ_ERROR: 16 | return error; 17 | case httpCode.COMMON_ERROR: 18 | const returnErr = (() => { 19 | try { 20 | return mapCommonErrorType(error.data); 21 | } catch (e) { 22 | return undefined; 23 | } 24 | })() 25 | if(!returnErr){ 26 | return error; 27 | } 28 | return ({...error, ...returnErr}); 29 | } 30 | } 31 | return error; 32 | } -------------------------------------------------------------------------------- /generator/template/ts/objs.gots: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is generated by 'protoapi' 3 | * This file contains all the data structure being used in the generated ts services 4 | * ----------------------------------------------------- 5 | * 该文件生成于protoapi 6 | * 文件包含API前端调用所引用的数据结构定义 7 | */ 8 | 9 | // enums 10 | {{- range .Enums }} 11 | export enum {{.Name}} { 12 | {{- range .Fields }} 13 | {{.Name}} = {{.Value}}, 14 | {{- end }} 15 | } 16 | {{end -}} 17 | // data types 18 | {{- range .DataTypes }} 19 | {{- $errorName := (getCommonErrorName .Name)}} 20 | export interface {{.Name}} { 21 | {{ if (isCommonError .Name) }} 22 | kind: {{$errorName}} 23 | {{end}} 24 | {{- range .Fields }} 25 | {{.Name}}: {{ tsType .DataType}}{{if eq .Label "LABEL_REPEATED"}}[]{{end}} 26 | {{- end }} 27 | } 28 | {{end -}} 29 | 30 | -------------------------------------------------------------------------------- /generator/template/yii2/RequestHandler.gophp: -------------------------------------------------------------------------------- 1 | response->statusCode = 400; 14 | $resp = $exception->to_array(); 15 | } else if ($exception instanceof ProtoApi\CommonErrorException) { 16 | Yii::$app->response->statusCode = 420; 17 | $resp = $exception->to_array(); 18 | } else { 19 | Yii::$app->response->statusCode = 500; 20 | $resp = array( 21 | "message"=>$exception->getMessage(), 22 | "stack"=>$exception->getTraceAsString(), 23 | ); 24 | } 25 | Yii::$app->response->data = $resp; 26 | Yii::$app->response->send(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /generator/template/yii2/handlers/RequestHandler.gophp: -------------------------------------------------------------------------------- 1 | response->statusCode = 400; 14 | $resp = $exception->to_array(); 15 | } else if ($exception instanceof ProtoApi\CommonErrorException) { 16 | Yii::$app->response->statusCode = 420; 17 | $resp = $exception->to_array(); 18 | } else { 19 | Yii::$app->response->statusCode = 500; 20 | $resp = array( 21 | "message"=>$exception->getMessage(), 22 | "stack"=>$exception->getTraceAsString(), 23 | ); 24 | } 25 | Yii::$app->response->data = $resp; 26 | Yii::$app->response->send(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/handlers/RequestHandler.php: -------------------------------------------------------------------------------- 1 | item = new Todo(); 14 | $this->item->init($response["item"]); 15 | } 16 | } 17 | 18 | public function validate() 19 | { 20 | if (!isset($this->item)) { 21 | throw new ProtoApi\GeneralException("'item' is not exist"); 22 | } 23 | $this->item->validate(); 24 | } 25 | 26 | public function set_item(Todo $item) 27 | { 28 | $this->item = $item; 29 | } 30 | 31 | public function get_item() 32 | { 33 | return $this->item; 34 | } 35 | 36 | public function to_array() 37 | { 38 | return array( 39 | "item" => $this->item->to_array(), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/AddResp.php: -------------------------------------------------------------------------------- 1 | set_count ( $response["count"] ); 14 | } 15 | } 16 | 17 | public function validate() 18 | { 19 | if (!isset($this->count)) { 20 | throw new ProtoApi\GeneralException("'count' is not exist"); 21 | } 22 | } 23 | 24 | public function set_count(int $count) 25 | { 26 | $this->count = $count; 27 | } 28 | 29 | public function get_count() 30 | { 31 | return $this->count; 32 | } 33 | 34 | public function to_array() 35 | { 36 | return array( 37 | "count" => $this->count, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/AuthError.php: -------------------------------------------------------------------------------- 1 | set_message ( $response["message"] ); 15 | } 16 | } 17 | 18 | public function validate() 19 | { 20 | if (!isset($this->message)) { 21 | throw new ProtoApi\GeneralException("'message' is not exist"); 22 | } 23 | } 24 | 25 | public function set_message(string $message) 26 | { 27 | $this->message = $message; 28 | } 29 | 30 | public function get_message() 31 | { 32 | return $this->message; 33 | } 34 | 35 | public function to_array() 36 | { 37 | return array( 38 | "message" => $this->message, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/BindError.php: -------------------------------------------------------------------------------- 1 | set_message ( $response["message"] ); 15 | } 16 | } 17 | 18 | public function validate() 19 | { 20 | if (!isset($this->message)) { 21 | throw new ProtoApi\GeneralException("'message' is not exist"); 22 | } 23 | } 24 | 25 | public function set_message(string $message) 26 | { 27 | $this->message = $message; 28 | } 29 | 30 | public function get_message() 31 | { 32 | return $this->message; 33 | } 34 | 35 | public function to_array() 36 | { 37 | return array( 38 | "message" => $this->message, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/Blank.php: -------------------------------------------------------------------------------- 1 | set_message ( $response["message"] ); 15 | } 16 | } 17 | 18 | public function validate() 19 | { 20 | if (!isset($this->message)) { 21 | throw new ProtoApi\GeneralException("'message' is not exist"); 22 | } 23 | } 24 | 25 | public function set_message(string $message) 26 | { 27 | $this->message = $message; 28 | } 29 | 30 | public function get_message() 31 | { 32 | return $this->message; 33 | } 34 | 35 | public function to_array() 36 | { 37 | return array( 38 | "message" => $this->message, 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/Todo.php: -------------------------------------------------------------------------------- 1 | set_title ( $response["title"] ); 14 | } 15 | } 16 | 17 | public function validate() 18 | { 19 | if (!isset($this->title)) { 20 | throw new ProtoApi\GeneralException("'title' is not exist"); 21 | } 22 | } 23 | 24 | public function set_title(string $title) 25 | { 26 | $this->title = $title; 27 | } 28 | 29 | public function get_title() 30 | { 31 | return $this->title; 32 | } 33 | 34 | public function to_array() 35 | { 36 | return array( 37 | "title" => $this->title, 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/expected/app/modules/todolist/models/ValidateErrorType.php: -------------------------------------------------------------------------------- 1 | envs; 12 | 13 | @JsonCreator 14 | public EnvListResponse(@JsonProperty("envs") List envs) { 15 | this.envs = envs; 16 | } 17 | 18 | public List getEnvs() { 19 | return envs; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/Error.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class Error { 11 | private final ErrorCode code; 12 | private final String message; 13 | 14 | @JsonCreator 15 | public Error(@JsonProperty("code") ErrorCode code, @JsonProperty("message") String message) { 16 | this.code = code; 17 | this.message = message; 18 | } 19 | 20 | public ErrorCode getCode() { 21 | return code; 22 | } 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/FieldError.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class FieldError { 11 | private final String fieldName; 12 | private final ValidateErrorType errorType; 13 | 14 | @JsonCreator 15 | public FieldError(@JsonProperty("fieldName") String fieldName, @JsonProperty("errorType") ValidateErrorType errorType) { 16 | this.fieldName = fieldName; 17 | this.errorType = errorType; 18 | } 19 | 20 | public String getFieldName() { 21 | return fieldName; 22 | } 23 | public ValidateErrorType getErrorType() { 24 | return errorType; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/GenericError.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class GenericError { 11 | private final String message; 12 | 13 | @JsonCreator 14 | public GenericError(@JsonProperty("message") String message) { 15 | this.message = message; 16 | } 17 | 18 | public String getMessage() { 19 | return message; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KVHistoryRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KVHistoryRequest { 11 | private final int service_id; 12 | private final int key_id; 13 | 14 | @JsonCreator 15 | public KVHistoryRequest(@JsonProperty("service_id") int service_id, @JsonProperty("key_id") int key_id) { 16 | this.service_id = service_id; 17 | this.key_id = key_id; 18 | } 19 | 20 | public int getService_id() { 21 | return service_id; 22 | } 23 | public int getKey_id() { 24 | return key_id; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KVHistoryResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KVHistoryResponse { 11 | private final List KVhistorys; 12 | 13 | @JsonCreator 14 | public KVHistoryResponse(@JsonProperty("KVhistorys") List KVhistorys) { 15 | this.KVhistorys = KVhistorys; 16 | } 17 | 18 | public List getKVhistorys() { 19 | return KVhistorys; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyListRequest { 11 | private final int service_id; 12 | private final int env_id; 13 | 14 | @JsonCreator 15 | public KeyListRequest(@JsonProperty("service_id") int service_id, @JsonProperty("env_id") int env_id) { 16 | this.service_id = service_id; 17 | this.env_id = env_id; 18 | } 19 | 20 | public int getService_id() { 21 | return service_id; 22 | } 23 | public int getEnv_id() { 24 | return env_id; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyListResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyListResponse { 11 | private final List keys; 12 | 13 | @JsonCreator 14 | public KeyListResponse(@JsonProperty("keys") List keys) { 15 | this.keys = keys; 16 | } 17 | 18 | public List getKeys() { 19 | return keys; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyValueListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyValueListRequest { 11 | private final int service_id; 12 | private final List keys; 13 | 14 | @JsonCreator 15 | public KeyValueListRequest(@JsonProperty("service_id") int service_id, @JsonProperty("keys") List keys) { 16 | this.service_id = service_id; 17 | this.keys = keys; 18 | } 19 | 20 | public int getService_id() { 21 | return service_id; 22 | } 23 | public List getKeys() { 24 | return keys; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyValueListResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyValueListResponse { 11 | private final List key_values; 12 | 13 | @JsonCreator 14 | public KeyValueListResponse(@JsonProperty("key_values") List key_values) { 15 | this.key_values = key_values; 16 | } 17 | 18 | public List getKey_values() { 19 | return key_values; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyValueRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyValueRequest { 11 | private final int service_id; 12 | private final List key_values; 13 | 14 | @JsonCreator 15 | public KeyValueRequest(@JsonProperty("service_id") int service_id, @JsonProperty("key_values") List key_values) { 16 | this.service_id = service_id; 17 | this.key_values = key_values; 18 | } 19 | 20 | public int getService_id() { 21 | return service_id; 22 | } 23 | public List getKey_values() { 24 | return key_values; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/KeyValueResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class KeyValueResponse { 11 | private final List key_values; 12 | 13 | @JsonCreator 14 | public KeyValueResponse(@JsonProperty("key_values") List key_values) { 15 | this.key_values = key_values; 16 | } 17 | 18 | public List getKey_values() { 19 | return key_values; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/Product.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class Product { 11 | private final String product_id; 12 | private final String product_name; 13 | 14 | @JsonCreator 15 | public Product(@JsonProperty("product_id") String product_id, @JsonProperty("product_name") String product_name) { 16 | this.product_id = product_id; 17 | this.product_name = product_name; 18 | } 19 | 20 | public String getProduct_id() { 21 | return product_id; 22 | } 23 | public String getProduct_name() { 24 | return product_name; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/ProductListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class ProductListRequest { 11 | private final int env_id; 12 | 13 | @JsonCreator 14 | public ProductListRequest(@JsonProperty("env_id") int env_id) { 15 | this.env_id = env_id; 16 | } 17 | 18 | public int getEnv_id() { 19 | return env_id; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/ProductListResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class ProductListResponse { 11 | private final List products; 12 | 13 | @JsonCreator 14 | public ProductListResponse(@JsonProperty("products") List products) { 15 | this.products = products; 16 | } 17 | 18 | public List getProducts() { 19 | return products; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/SearchKeyValueListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class SearchKeyValueListRequest { 11 | private final String key; 12 | private final int service_id; 13 | private final int env_id; 14 | 15 | @JsonCreator 16 | public SearchKeyValueListRequest(@JsonProperty("key") String key, @JsonProperty("service_id") int service_id, @JsonProperty("env_id") int env_id) { 17 | this.key = key; 18 | this.service_id = service_id; 19 | this.env_id = env_id; 20 | } 21 | 22 | public String getKey() { 23 | return key; 24 | } 25 | public int getService_id() { 26 | return service_id; 27 | } 28 | public int getEnv_id() { 29 | return env_id; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/ServiceListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class ServiceListRequest { 11 | private final List tag_ids; 12 | private final int env_id; 13 | private final int offset; 14 | private final int limit; 15 | 16 | @JsonCreator 17 | public ServiceListRequest(@JsonProperty("tag_ids") List tag_ids, @JsonProperty("env_id") int env_id, @JsonProperty("offset") int offset, @JsonProperty("limit") int limit) { 18 | this.tag_ids = tag_ids; 19 | this.env_id = env_id; 20 | this.offset = offset; 21 | this.limit = limit; 22 | } 23 | 24 | public List getTag_ids() { 25 | return tag_ids; 26 | } 27 | public int getEnv_id() { 28 | return env_id; 29 | } 30 | public int getOffset() { 31 | return offset; 32 | } 33 | public int getLimit() { 34 | return limit; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/ServiceListResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class ServiceListResponse { 11 | private final List services; 12 | private final int offset; 13 | private final int limit; 14 | private final int total; 15 | 16 | @JsonCreator 17 | public ServiceListResponse(@JsonProperty("services") List services, @JsonProperty("offset") int offset, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { 18 | this.services = services; 19 | this.offset = offset; 20 | this.limit = limit; 21 | this.total = total; 22 | } 23 | 24 | public List getServices() { 25 | return services; 26 | } 27 | public int getOffset() { 28 | return offset; 29 | } 30 | public int getLimit() { 31 | return limit; 32 | } 33 | public int getTotal() { 34 | return total; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/Tag.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class Tag { 11 | private final int tag_id; 12 | private final String tag_name; 13 | 14 | @JsonCreator 15 | public Tag(@JsonProperty("tag_id") int tag_id, @JsonProperty("tag_name") String tag_name) { 16 | this.tag_id = tag_id; 17 | this.tag_name = tag_name; 18 | } 19 | 20 | public int getTag_id() { 21 | return tag_id; 22 | } 23 | public String getTag_name() { 24 | return tag_name; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/TagListRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class TagListRequest { 11 | 12 | @JsonCreator 13 | public TagListRequest() { 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/TagListResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class TagListResponse { 11 | private final List tags; 12 | 13 | @JsonCreator 14 | public TagListResponse(@JsonProperty("tags") List tags) { 15 | this.tags = tags; 16 | } 17 | 18 | public List getTags() { 19 | return tags; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/UpdateServiceRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class UpdateServiceRequest { 11 | private final int service_id; 12 | private final List tags; 13 | private final String desc; 14 | 15 | @JsonCreator 16 | public UpdateServiceRequest(@JsonProperty("service_id") int service_id, @JsonProperty("tags") List tags, @JsonProperty("desc") String desc) { 17 | this.service_id = service_id; 18 | this.tags = tags; 19 | this.desc = desc; 20 | } 21 | 22 | public int getService_id() { 23 | return service_id; 24 | } 25 | public List getTags() { 26 | return tags; 27 | } 28 | public String getDesc() { 29 | return desc; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/UpdateServiceResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class UpdateServiceResponse { 11 | private final int service_id; 12 | private final List tags; 13 | private final String desc; 14 | 15 | @JsonCreator 16 | public UpdateServiceResponse(@JsonProperty("service_id") int service_id, @JsonProperty("tags") List tags, @JsonProperty("desc") String desc) { 17 | this.service_id = service_id; 18 | this.tags = tags; 19 | this.desc = desc; 20 | } 21 | 22 | public int getService_id() { 23 | return service_id; 24 | } 25 | public List getTags() { 26 | return tags; 27 | } 28 | public String getDesc() { 29 | return desc; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/UploadProtoFileRequest.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class UploadProtoFileRequest { 11 | private final int service_id; 12 | private final int env_id; 13 | private final String file; 14 | 15 | @JsonCreator 16 | public UploadProtoFileRequest(@JsonProperty("service_id") int service_id, @JsonProperty("env_id") int env_id, @JsonProperty("file") String file) { 17 | this.service_id = service_id; 18 | this.env_id = env_id; 19 | this.file = file; 20 | } 21 | 22 | public int getService_id() { 23 | return service_id; 24 | } 25 | public int getEnv_id() { 26 | return env_id; 27 | } 28 | public String getFile() { 29 | return file; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/UploadProtoFileResponse.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class UploadProtoFileResponse { 11 | private final int service_id; 12 | private final int env_id; 13 | private final int key_count; 14 | 15 | @JsonCreator 16 | public UploadProtoFileResponse(@JsonProperty("service_id") int service_id, @JsonProperty("env_id") int env_id, @JsonProperty("key_count") int key_count) { 17 | this.service_id = service_id; 18 | this.env_id = env_id; 19 | this.key_count = key_count; 20 | } 21 | 22 | public int getService_id() { 23 | return service_id; 24 | } 25 | public int getEnv_id() { 26 | return env_id; 27 | } 28 | public int getKey_count() { 29 | return key_count; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/expected/com/yoozoo/spring/ValidateError.java: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi; DO NOT EDIT. 2 | 3 | package com.yoozoo.spring; 4 | 5 | import com.fasterxml.jackson.annotation.JsonCreator; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import java.util.List; 9 | 10 | public class ValidateError { 11 | private final List errors; 12 | 13 | @JsonCreator 14 | public ValidateError(@JsonProperty("errors") List errors) { 15 | this.errors = errors; 16 | } 17 | 18 | public List getErrors() { 19 | return errors; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/expected/go/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/go/.keep -------------------------------------------------------------------------------- /test/expected/go/apisvr/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | 45 | func (r *CommonError) Error() string { 46 | return "Error" 47 | } 48 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Env.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Env 6 | type Env struct { 7 | Env_id int `json:"env_id"` 8 | Env_name string `json:"env_name"` 9 | } 10 | 11 | func (r *Env) GetEnv_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Env_id 17 | } 18 | 19 | func (r *Env) GetEnv_name() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Env_name 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/EnvListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // EnvListRequest 6 | type EnvListRequest struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/EnvListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // EnvListResponse 6 | type EnvListResponse struct { 7 | Envs []*Env `json:"envs"` 8 | } 9 | 10 | func (r *EnvListResponse) GetEnvs() []*Env { 11 | if r == nil { 12 | var zeroVal []*Env 13 | return zeroVal 14 | } 15 | return r.Envs 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Error.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Error 6 | type Error struct { 7 | Code ErrorCode `json:"code"` 8 | Message string `json:"message"` 9 | } 10 | 11 | func (r *Error) GetCode() ErrorCode { 12 | if r == nil { 13 | var zeroVal ErrorCode 14 | return zeroVal 15 | } 16 | return r.Code 17 | } 18 | 19 | func (r *Error) GetMessage() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Message 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ErrorCode.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | type ErrorCode int 6 | 7 | const ( 8 | DefaultError ErrorCode = 0 9 | GeneralError ErrorCode = 1000 10 | DatabaseError ErrorCode = 1001 11 | EtcdError ErrorCode = 1002 12 | SystemError ErrorCode = 1003 13 | ) 14 | 15 | func (code ErrorCode) String() string { 16 | names := map[ErrorCode]string{ 17 | DefaultError: "DefaultError", 18 | GeneralError: "GeneralError", 19 | DatabaseError: "DatabaseError", 20 | EtcdError: "EtcdError", 21 | SystemError: "SystemError", 22 | } 23 | 24 | return names[code] 25 | } 26 | 27 | func (code ErrorCode) Code() int { 28 | return (int)(code) 29 | } 30 | 31 | func (code ErrorCode) IsDefaultError() bool { 32 | return code == DefaultError 33 | } 34 | 35 | func (code ErrorCode) IsGeneralError() bool { 36 | return code == GeneralError 37 | } 38 | 39 | func (code ErrorCode) IsDatabaseError() bool { 40 | return code == DatabaseError 41 | } 42 | 43 | func (code ErrorCode) IsEtcdError() bool { 44 | return code == EtcdError 45 | } 46 | 47 | func (code ErrorCode) IsSystemError() bool { 48 | return code == SystemError 49 | } 50 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KVHistoryItem.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KVHistoryItem 6 | type KVHistoryItem struct { 7 | Updated_value string `json:"updated_value"` 8 | Updated_date string `json:"updated_date"` 9 | Updated_by string `json:"updated_by"` 10 | Revision int64 `json:"revision"` 11 | } 12 | 13 | func (r *KVHistoryItem) GetUpdated_value() string { 14 | if r == nil { 15 | var zeroVal string 16 | return zeroVal 17 | } 18 | return r.Updated_value 19 | } 20 | 21 | func (r *KVHistoryItem) GetUpdated_date() string { 22 | if r == nil { 23 | var zeroVal string 24 | return zeroVal 25 | } 26 | return r.Updated_date 27 | } 28 | 29 | func (r *KVHistoryItem) GetUpdated_by() string { 30 | if r == nil { 31 | var zeroVal string 32 | return zeroVal 33 | } 34 | return r.Updated_by 35 | } 36 | 37 | func (r *KVHistoryItem) GetRevision() int64 { 38 | if r == nil { 39 | var zeroVal int64 40 | return zeroVal 41 | } 42 | return r.Revision 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KVHistoryRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KVHistoryRequest 6 | type KVHistoryRequest struct { 7 | Service_id int `json:"service_id"` 8 | Key_id int `json:"key_id"` 9 | } 10 | 11 | func (r *KVHistoryRequest) GetService_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Service_id 17 | } 18 | 19 | func (r *KVHistoryRequest) GetKey_id() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Key_id 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KVHistoryResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KVHistoryResponse 6 | type KVHistoryResponse struct { 7 | KVhistorys []*KVHistoryItem `json:"KVhistorys"` 8 | } 9 | 10 | func (r *KVHistoryResponse) GetKVhistorys() []*KVHistoryItem { 11 | if r == nil { 12 | var zeroVal []*KVHistoryItem 13 | return zeroVal 14 | } 15 | return r.KVhistorys 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Key.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Key 6 | type Key struct { 7 | Key_id int `json:"key_id"` 8 | Key string `json:"key"` 9 | DataType string `json:"dataType"` 10 | DefaultValue string `json:"defaultValue"` 11 | IsWatched bool `json:"isWatched"` 12 | } 13 | 14 | func (r *Key) GetKey_id() int { 15 | if r == nil { 16 | var zeroVal int 17 | return zeroVal 18 | } 19 | return r.Key_id 20 | } 21 | 22 | func (r *Key) GetKey() string { 23 | if r == nil { 24 | var zeroVal string 25 | return zeroVal 26 | } 27 | return r.Key 28 | } 29 | 30 | func (r *Key) GetDataType() string { 31 | if r == nil { 32 | var zeroVal string 33 | return zeroVal 34 | } 35 | return r.DataType 36 | } 37 | 38 | func (r *Key) GetDefaultValue() string { 39 | if r == nil { 40 | var zeroVal string 41 | return zeroVal 42 | } 43 | return r.DefaultValue 44 | } 45 | 46 | func (r *Key) GetIsWatched() bool { 47 | if r == nil { 48 | var zeroVal bool 49 | return zeroVal 50 | } 51 | return r.IsWatched 52 | } 53 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyListRequest 6 | type KeyListRequest struct { 7 | Service_id int `json:"service_id"` 8 | Env_id int `json:"env_id"` 9 | } 10 | 11 | func (r *KeyListRequest) GetService_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Service_id 17 | } 18 | 19 | func (r *KeyListRequest) GetEnv_id() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Env_id 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyListResponse 6 | type KeyListResponse struct { 7 | Keys []*Key `json:"keys"` 8 | } 9 | 10 | func (r *KeyListResponse) GetKeys() []*Key { 11 | if r == nil { 12 | var zeroVal []*Key 13 | return zeroVal 14 | } 15 | return r.Keys 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyValueListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyValueListRequest 6 | type KeyValueListRequest struct { 7 | Service_id int `json:"service_id"` 8 | Keys []*Key `json:"keys"` 9 | } 10 | 11 | func (r *KeyValueListRequest) GetService_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Service_id 17 | } 18 | 19 | func (r *KeyValueListRequest) GetKeys() []*Key { 20 | if r == nil { 21 | var zeroVal []*Key 22 | return zeroVal 23 | } 24 | return r.Keys 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyValueListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyValueListResponse 6 | type KeyValueListResponse struct { 7 | Key_values []*KeyValue `json:"key_values"` 8 | } 9 | 10 | func (r *KeyValueListResponse) GetKey_values() []*KeyValue { 11 | if r == nil { 12 | var zeroVal []*KeyValue 13 | return zeroVal 14 | } 15 | return r.Key_values 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyValueRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyValueRequest 6 | type KeyValueRequest struct { 7 | Service_id int `json:"service_id"` 8 | Key_values []*KeyValue `json:"key_values"` 9 | } 10 | 11 | func (r *KeyValueRequest) GetService_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Service_id 17 | } 18 | 19 | func (r *KeyValueRequest) GetKey_values() []*KeyValue { 20 | if r == nil { 21 | var zeroVal []*KeyValue 22 | return zeroVal 23 | } 24 | return r.Key_values 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/KeyValueResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // KeyValueResponse 6 | type KeyValueResponse struct { 7 | Key_values []*KeyValue `json:"key_values"` 8 | } 9 | 10 | func (r *KeyValueResponse) GetKey_values() []*KeyValue { 11 | if r == nil { 12 | var zeroVal []*KeyValue 13 | return zeroVal 14 | } 15 | return r.Key_values 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Product.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Product 6 | type Product struct { 7 | Product_id string `json:"product_id"` 8 | Product_name string `json:"product_name"` 9 | } 10 | 11 | func (r *Product) GetProduct_id() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.Product_id 17 | } 18 | 19 | func (r *Product) GetProduct_name() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Product_name 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ProductListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // ProductListRequest 6 | type ProductListRequest struct { 7 | Env_id int `json:"env_id"` 8 | } 9 | 10 | func (r *ProductListRequest) GetEnv_id() int { 11 | if r == nil { 12 | var zeroVal int 13 | return zeroVal 14 | } 15 | return r.Env_id 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ProductListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // ProductListResponse 6 | type ProductListResponse struct { 7 | Products []*Product `json:"products"` 8 | } 9 | 10 | func (r *ProductListResponse) GetProducts() []*Product { 11 | if r == nil { 12 | var zeroVal []*Product 13 | return zeroVal 14 | } 15 | return r.Products 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/RegisterServiceResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // RegisterServiceResponse 6 | type RegisterServiceResponse struct { 7 | Env_id int `json:"env_id"` 8 | Product_id string `json:"product_id"` 9 | Service_id int `json:"service_id"` 10 | Service_name string `json:"service_name"` 11 | } 12 | 13 | func (r *RegisterServiceResponse) GetEnv_id() int { 14 | if r == nil { 15 | var zeroVal int 16 | return zeroVal 17 | } 18 | return r.Env_id 19 | } 20 | 21 | func (r *RegisterServiceResponse) GetProduct_id() string { 22 | if r == nil { 23 | var zeroVal string 24 | return zeroVal 25 | } 26 | return r.Product_id 27 | } 28 | 29 | func (r *RegisterServiceResponse) GetService_id() int { 30 | if r == nil { 31 | var zeroVal int 32 | return zeroVal 33 | } 34 | return r.Service_id 35 | } 36 | 37 | func (r *RegisterServiceResponse) GetService_name() string { 38 | if r == nil { 39 | var zeroVal string 40 | return zeroVal 41 | } 42 | return r.Service_name 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/SearchKeyValueListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // SearchKeyValueListRequest 6 | type SearchKeyValueListRequest struct { 7 | Key string `json:"key"` 8 | Service_id int `json:"service_id"` 9 | Env_id int `json:"env_id"` 10 | } 11 | 12 | func (r *SearchKeyValueListRequest) GetKey() string { 13 | if r == nil { 14 | var zeroVal string 15 | return zeroVal 16 | } 17 | return r.Key 18 | } 19 | 20 | func (r *SearchKeyValueListRequest) GetService_id() int { 21 | if r == nil { 22 | var zeroVal int 23 | return zeroVal 24 | } 25 | return r.Service_id 26 | } 27 | 28 | func (r *SearchKeyValueListRequest) GetEnv_id() int { 29 | if r == nil { 30 | var zeroVal int 31 | return zeroVal 32 | } 33 | return r.Env_id 34 | } 35 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ServiceListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // ServiceListRequest 6 | type ServiceListRequest struct { 7 | Tag_ids []int `json:"tag_ids"` 8 | Env_id int `json:"env_id"` 9 | Offset int `json:"offset"` 10 | Limit int `json:"limit"` 11 | } 12 | 13 | func (r *ServiceListRequest) GetTag_ids() []int { 14 | if r == nil { 15 | var zeroVal []int 16 | return zeroVal 17 | } 18 | return r.Tag_ids 19 | } 20 | 21 | func (r *ServiceListRequest) GetEnv_id() int { 22 | if r == nil { 23 | var zeroVal int 24 | return zeroVal 25 | } 26 | return r.Env_id 27 | } 28 | 29 | func (r *ServiceListRequest) GetOffset() int { 30 | if r == nil { 31 | var zeroVal int 32 | return zeroVal 33 | } 34 | return r.Offset 35 | } 36 | 37 | func (r *ServiceListRequest) GetLimit() int { 38 | if r == nil { 39 | var zeroVal int 40 | return zeroVal 41 | } 42 | return r.Limit 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ServiceListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // ServiceListResponse 6 | type ServiceListResponse struct { 7 | Services []*Service `json:"services"` 8 | Offset int `json:"offset"` 9 | Limit int `json:"limit"` 10 | Total int `json:"total"` 11 | } 12 | 13 | func (r *ServiceListResponse) GetServices() []*Service { 14 | if r == nil { 15 | var zeroVal []*Service 16 | return zeroVal 17 | } 18 | return r.Services 19 | } 20 | 21 | func (r *ServiceListResponse) GetOffset() int { 22 | if r == nil { 23 | var zeroVal int 24 | return zeroVal 25 | } 26 | return r.Offset 27 | } 28 | 29 | func (r *ServiceListResponse) GetLimit() int { 30 | if r == nil { 31 | var zeroVal int 32 | return zeroVal 33 | } 34 | return r.Limit 35 | } 36 | 37 | func (r *ServiceListResponse) GetTotal() int { 38 | if r == nil { 39 | var zeroVal int 40 | return zeroVal 41 | } 42 | return r.Total 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/Tag.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // Tag 6 | type Tag struct { 7 | Tag_id int `json:"tag_id"` 8 | Tag_name string `json:"tag_name"` 9 | } 10 | 11 | func (r *Tag) GetTag_id() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Tag_id 17 | } 18 | 19 | func (r *Tag) GetTag_name() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Tag_name 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/TagListRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // TagListRequest 6 | type TagListRequest struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/TagListResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // TagListResponse 6 | type TagListResponse struct { 7 | Tags []*Tag `json:"tags"` 8 | } 9 | 10 | func (r *TagListResponse) GetTags() []*Tag { 11 | if r == nil { 12 | var zeroVal []*Tag 13 | return zeroVal 14 | } 15 | return r.Tags 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/UpdateServiceRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // UpdateServiceRequest 6 | type UpdateServiceRequest struct { 7 | Service_id int `json:"service_id"` 8 | Tags []*Tag `json:"tags"` 9 | Desc string `json:"desc"` 10 | } 11 | 12 | func (r *UpdateServiceRequest) GetService_id() int { 13 | if r == nil { 14 | var zeroVal int 15 | return zeroVal 16 | } 17 | return r.Service_id 18 | } 19 | 20 | func (r *UpdateServiceRequest) GetTags() []*Tag { 21 | if r == nil { 22 | var zeroVal []*Tag 23 | return zeroVal 24 | } 25 | return r.Tags 26 | } 27 | 28 | func (r *UpdateServiceRequest) GetDesc() string { 29 | if r == nil { 30 | var zeroVal string 31 | return zeroVal 32 | } 33 | return r.Desc 34 | } 35 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/UpdateServiceResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // UpdateServiceResponse 6 | type UpdateServiceResponse struct { 7 | Service_id int `json:"service_id"` 8 | Tags []*Tag `json:"tags"` 9 | Desc string `json:"desc"` 10 | } 11 | 12 | func (r *UpdateServiceResponse) GetService_id() int { 13 | if r == nil { 14 | var zeroVal int 15 | return zeroVal 16 | } 17 | return r.Service_id 18 | } 19 | 20 | func (r *UpdateServiceResponse) GetTags() []*Tag { 21 | if r == nil { 22 | var zeroVal []*Tag 23 | return zeroVal 24 | } 25 | return r.Tags 26 | } 27 | 28 | func (r *UpdateServiceResponse) GetDesc() string { 29 | if r == nil { 30 | var zeroVal string 31 | return zeroVal 32 | } 33 | return r.Desc 34 | } 35 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/UploadProtoFileRequest.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // UploadProtoFileRequest 6 | type UploadProtoFileRequest struct { 7 | Service_id int `json:"service_id"` 8 | Env_id int `json:"env_id"` 9 | File string `json:"file"` 10 | } 11 | 12 | func (r *UploadProtoFileRequest) GetService_id() int { 13 | if r == nil { 14 | var zeroVal int 15 | return zeroVal 16 | } 17 | return r.Service_id 18 | } 19 | 20 | func (r *UploadProtoFileRequest) GetEnv_id() int { 21 | if r == nil { 22 | var zeroVal int 23 | return zeroVal 24 | } 25 | return r.Env_id 26 | } 27 | 28 | func (r *UploadProtoFileRequest) GetFile() string { 29 | if r == nil { 30 | var zeroVal string 31 | return zeroVal 32 | } 33 | return r.File 34 | } 35 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/UploadProtoFileResponse.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // UploadProtoFileResponse 6 | type UploadProtoFileResponse struct { 7 | Service_id int `json:"service_id"` 8 | Env_id int `json:"env_id"` 9 | Key_count int `json:"key_count"` 10 | } 11 | 12 | func (r *UploadProtoFileResponse) GetService_id() int { 13 | if r == nil { 14 | var zeroVal int 15 | return zeroVal 16 | } 17 | return r.Service_id 18 | } 19 | 20 | func (r *UploadProtoFileResponse) GetEnv_id() int { 21 | if r == nil { 22 | var zeroVal int 23 | return zeroVal 24 | } 25 | return r.Env_id 26 | } 27 | 28 | func (r *UploadProtoFileResponse) GetKey_count() int { 29 | if r == nil { 30 | var zeroVal int 31 | return zeroVal 32 | } 33 | return r.Key_count 34 | } 35 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/apisvr/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package apisvr 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/AddError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AddError 6 | type AddError struct { 7 | Req *AddReq `json:"req"` 8 | Error string `json:"error"` 9 | } 10 | 11 | func (r *AddError) GetReq() *AddReq { 12 | if r == nil { 13 | var zeroVal *AddReq 14 | return zeroVal 15 | } 16 | return r.Req 17 | } 18 | 19 | func (r *AddError) GetError() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Error 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/AddResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AddResp 6 | type AddResp struct { 7 | Result int `json:"result"` 8 | } 9 | 10 | func (r *AddResp) GetResult() int { 11 | if r == nil { 12 | var zeroVal int 13 | return zeroVal 14 | } 15 | return r.Result 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/calcsvr/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/go/echosvr/Msg.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package echosvr 4 | 5 | // Msg 6 | type Msg struct { 7 | Msg string `json:"msg"` 8 | } 9 | 10 | func (r *Msg) GetMsg() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Msg 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/AddError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // AddError 6 | type AddError struct { 7 | Req *AddReq `json:"req"` 8 | Error string `json:"error"` 9 | } 10 | 11 | func (r *AddError) GetReq() *AddReq { 12 | if r == nil { 13 | var zeroVal *AddReq 14 | return zeroVal 15 | } 16 | return r.Req 17 | } 18 | 19 | func (r *AddError) GetError() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Error 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/nested/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/nested/AddResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // AddResp 6 | type AddResp struct { 7 | Result int `json:"result"` 8 | Extra *Extra `json:"extra"` 9 | } 10 | 11 | func (r *AddResp) GetResult() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.Result 17 | } 18 | 19 | func (r *AddResp) GetExtra() *Extra { 20 | if r == nil { 21 | var zeroVal *Extra 22 | return zeroVal 23 | } 24 | return r.Extra 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/nested/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/go/nested/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/nested/Extra.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // Extra 6 | type Extra struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *Extra) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/nested/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/nested/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package nested 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/AddError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // AddError 6 | type AddError struct { 7 | Req *AddReq `json:"req"` 8 | Error string `json:"error"` 9 | } 10 | 11 | func (r *AddError) GetReq() *AddReq { 12 | if r == nil { 13 | var zeroVal *AddReq 14 | return zeroVal 15 | } 16 | return r.Req 17 | } 18 | 19 | func (r *AddError) GetError() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Error 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // AddReq 6 | type AddReq struct { 7 | Item *Todo `json:"item"` 8 | } 9 | 10 | func (r *AddReq) GetItem() *Todo { 11 | if r == nil { 12 | var zeroVal *Todo 13 | return zeroVal 14 | } 15 | return r.Item 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/AddResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // AddResp 6 | type AddResp struct { 7 | Count int `json:"count"` 8 | } 9 | 10 | func (r *AddResp) GetCount() int { 11 | if r == nil { 12 | var zeroVal int 13 | return zeroVal 14 | } 15 | return r.Count 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | 45 | func (r *CommonError) Error() string { 46 | return "Error" 47 | } 48 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/ListResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // ListResp 6 | type ListResp struct { 7 | Items []*Todo `json:"items"` 8 | } 9 | 10 | func (r *ListResp) GetItems() []*Todo { 11 | if r == nil { 12 | var zeroVal []*Todo 13 | return zeroVal 14 | } 15 | return r.Items 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/Todo.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // Todo 6 | type Todo struct { 7 | Title string `json:"title"` 8 | } 9 | 10 | func (r *Todo) GetTitle() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Title 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/go/todolistsvr/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package todolistsvr 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/package/go/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/package/go/.keep -------------------------------------------------------------------------------- /test/expected/package/go/calc/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calc 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvr/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/AddError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // AddError 6 | type AddError struct { 7 | Req *AddReq `json:"req"` 8 | Error string `json:"error"` 9 | } 10 | 11 | func (r *AddError) GetReq() *AddReq { 12 | if r == nil { 13 | var zeroVal *AddReq 14 | return zeroVal 15 | } 16 | return r.Req 17 | } 18 | 19 | func (r *AddError) GetError() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Error 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/AddResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // AddResp 6 | type AddResp struct { 7 | Result int `json:"result"` 8 | } 9 | 10 | func (r *AddResp) GetResult() int { 11 | if r == nil { 12 | var zeroVal int 13 | return zeroVal 14 | } 15 | return r.Result 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/AddError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // AddError 6 | type AddError struct { 7 | Req *AddReq `json:"req"` 8 | Error string `json:"error"` 9 | } 10 | 11 | func (r *AddError) GetReq() *AddReq { 12 | if r == nil { 13 | var zeroVal *AddReq 14 | return zeroVal 15 | } 16 | return r.Req 17 | } 18 | 19 | func (r *AddError) GetError() string { 20 | if r == nil { 21 | var zeroVal string 22 | return zeroVal 23 | } 24 | return r.Error 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/AddResp.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // AddResp 6 | type AddResp struct { 7 | Result int `json:"result"` 8 | } 9 | 10 | func (r *AddResp) GetResult() int { 11 | if r == nil { 12 | var zeroVal int 13 | return zeroVal 14 | } 15 | return r.Result 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/calcsvrmain_without/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvrmain_without 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/package/go/common/AuthError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // AuthError 6 | type AuthError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *AuthError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/common/BindError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // BindError 6 | type BindError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *BindError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/common/CommonError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // CommonError 6 | type CommonError struct { 7 | GenericError *GenericError `json:"genericError"` 8 | AuthError *AuthError `json:"authError"` 9 | ValidateError *ValidateError `json:"validateError"` 10 | BindError *BindError `json:"bindError"` 11 | } 12 | 13 | func (r *CommonError) GetGenericError() *GenericError { 14 | if r == nil { 15 | var zeroVal *GenericError 16 | return zeroVal 17 | } 18 | return r.GenericError 19 | } 20 | 21 | func (r *CommonError) GetAuthError() *AuthError { 22 | if r == nil { 23 | var zeroVal *AuthError 24 | return zeroVal 25 | } 26 | return r.AuthError 27 | } 28 | 29 | func (r *CommonError) GetValidateError() *ValidateError { 30 | if r == nil { 31 | var zeroVal *ValidateError 32 | return zeroVal 33 | } 34 | return r.ValidateError 35 | } 36 | 37 | func (r *CommonError) GetBindError() *BindError { 38 | if r == nil { 39 | var zeroVal *BindError 40 | return zeroVal 41 | } 42 | return r.BindError 43 | } 44 | -------------------------------------------------------------------------------- /test/expected/package/go/common/Empty.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // Empty 6 | type Empty struct { 7 | } 8 | -------------------------------------------------------------------------------- /test/expected/package/go/common/FieldError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // FieldError 6 | type FieldError struct { 7 | FieldName string `json:"fieldName"` 8 | ErrorType ValidateErrorType `json:"errorType"` 9 | } 10 | 11 | func (r *FieldError) GetFieldName() string { 12 | if r == nil { 13 | var zeroVal string 14 | return zeroVal 15 | } 16 | return r.FieldName 17 | } 18 | 19 | func (r *FieldError) GetErrorType() ValidateErrorType { 20 | if r == nil { 21 | var zeroVal ValidateErrorType 22 | return zeroVal 23 | } 24 | return r.ErrorType 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/package/go/common/GenericError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // GenericError 6 | type GenericError struct { 7 | Message string `json:"message"` 8 | } 9 | 10 | func (r *GenericError) GetMessage() string { 11 | if r == nil { 12 | var zeroVal string 13 | return zeroVal 14 | } 15 | return r.Message 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/common/ValidateError.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | // ValidateError 6 | type ValidateError struct { 7 | Errors []*FieldError `json:"errors"` 8 | } 9 | 10 | func (r *ValidateError) GetErrors() []*FieldError { 11 | if r == nil { 12 | var zeroVal []*FieldError 13 | return zeroVal 14 | } 15 | return r.Errors 16 | } 17 | -------------------------------------------------------------------------------- /test/expected/package/go/common/ValidateErrorType.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package common 4 | 5 | type ValidateErrorType int 6 | 7 | const ( 8 | INVALID_EMAIL ValidateErrorType = 0 9 | FIELD_REQUIRED ValidateErrorType = 1 10 | ) 11 | 12 | func (code ValidateErrorType) String() string { 13 | names := map[ValidateErrorType]string{ 14 | INVALID_EMAIL: "INVALID_EMAIL", 15 | FIELD_REQUIRED: "FIELD_REQUIRED", 16 | } 17 | 18 | return names[code] 19 | } 20 | 21 | func (code ValidateErrorType) Code() int { 22 | return (int)(code) 23 | } 24 | 25 | func (code ValidateErrorType) IsINVALID_EMAIL() bool { 26 | return code == INVALID_EMAIL 27 | } 28 | 29 | func (code ValidateErrorType) IsFIELD_REQUIRED() bool { 30 | return code == FIELD_REQUIRED 31 | } 32 | -------------------------------------------------------------------------------- /test/expected/package/go/github.com/yoozoo/protoapi/calcsvr/AddReq.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoapi:go; DO NOT EDIT. 2 | 3 | package calcsvr 4 | 5 | // AddReq 6 | type AddReq struct { 7 | X int `json:"x"` 8 | Y int `json:"y"` 9 | } 10 | 11 | func (r *AddReq) GetX() int { 12 | if r == nil { 13 | var zeroVal int 14 | return zeroVal 15 | } 16 | return r.X 17 | } 18 | 19 | func (r *AddReq) GetY() int { 20 | if r == nil { 21 | var zeroVal int 22 | return zeroVal 23 | } 24 | return r.Y 25 | } 26 | -------------------------------------------------------------------------------- /test/expected/ts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/ts/.keep -------------------------------------------------------------------------------- /test/expected/ts/axios/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/ts/axios/.keep -------------------------------------------------------------------------------- /test/expected/ts/fetch/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/ts/fetch/.keep -------------------------------------------------------------------------------- /test/expected/ts/wechat/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/expected/ts/wechat/.keep -------------------------------------------------------------------------------- /test/proto/calc.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | 9 | option go_package = "calcsvr"; 10 | 11 | message AddReq { 12 | int32 x = 1; 13 | int32 y = 2; 14 | } 15 | 16 | message AddResp { 17 | int32 result = 1; 18 | } 19 | 20 | message AddError { 21 | AddReq req = 1; 22 | string error = 2; 23 | } 24 | 25 | service CalcService { 26 | option (auth) = true; 27 | rpc add(AddReq) returns (AddResp) { 28 | option (error) = "AddError"; 29 | } 30 | } 31 | 32 | service ExtendCalcService { 33 | rpc minus(AddReq) returns (AddResp) { 34 | option (error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/common.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/descriptor.proto"; 4 | 5 | extend google.protobuf.MethodOptions { 6 | string service_method = 51006; 7 | string error = 51007; 8 | } 9 | 10 | extend google.protobuf.ServiceOptions { 11 | string common_error = 51008; 12 | bool auth = 51009; 13 | } 14 | 15 | extend google.protobuf.FieldOptions { 16 | string val_format = 51002; 17 | bool val_required = 51003; 18 | int32 min = 51004; 19 | int32 max = 51005; 20 | } 21 | 22 | message CommonError { 23 | GenericError genericError = 1; 24 | AuthError authError = 2; 25 | ValidateError validateError = 3; 26 | BindError bindError = 4; 27 | } 28 | 29 | message GenericError { string message = 1; } 30 | 31 | message AuthError { string message = 1; } 32 | 33 | message BindError { string message = 1; } 34 | 35 | message ValidateError { repeated FieldError errors = 1; } 36 | 37 | message FieldError { 38 | string fieldName = 1; 39 | ValidateErrorType errorType = 2; 40 | } 41 | 42 | enum ValidateErrorType { 43 | INVALID_EMAIL = 0; 44 | FIELD_REQUIRED = 1; 45 | } 46 | 47 | message Empty {} 48 | -------------------------------------------------------------------------------- /test/proto/confusion.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "confusion2.proto"; 9 | 10 | package a; 11 | option go_package = "nested"; 12 | 13 | message b{ 14 | message c {} 15 | int32 bb = 1; 16 | c cc = 2; 17 | } 18 | 19 | service CalcService { 20 | rpc add(a.b) returns (a.b.c) {} 21 | } 22 | -------------------------------------------------------------------------------- /test/proto/confusion2.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | 9 | package a.b; 10 | option go_package = "nested"; 11 | 12 | message c{ 13 | int32 cc = 1; 14 | } 15 | -------------------------------------------------------------------------------- /test/proto/echo.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | option go_package = "echosvr"; 8 | 9 | message msg { 10 | string msg = 1; 11 | } 12 | 13 | service EchoService { 14 | rpc echo(msg) returns (msg) {} 15 | } 16 | -------------------------------------------------------------------------------- /test/proto/login.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | 9 | message LoginReq { 10 | string account = 1; //Account name 11 | /* 12 | game id refer to game table 13 | */ 14 | int32 game_id = 2; 15 | //operation Id 16 | int32 op_id = 3; // test table 17 | int32 server_id = 4; 18 | } 19 | 20 | // login request return 21 | message LoginResp { 22 | int32 code = 1; 23 | string msg = 2; 24 | LoginInfo loginInfo = 3; 25 | repeated string data = 4; 26 | } 27 | 28 | message AccountInfo { 29 | string account_name = 1; 30 | string join_time = 2; 31 | } 32 | 33 | message LoginInfo { 34 | string user_id = 1; 35 | string last_login = 2; 36 | bool is_vip = 3; 37 | repeated AccountInfo accountInfo = 4; 38 | VipStatus vipStatus = 5; //this is an enum 39 | } 40 | 41 | 42 | 43 | enum VipStatus { 44 | UNKNOWN = 0; //default value for status 45 | VIP_1 = 1; 46 | VIP_2 = 2; 47 | } 48 | 49 | //test service comment 50 | service LoginService { 51 | //test method comment 52 | rpc logingame(LoginReq) returns (LoginResp) { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /test/proto/nested.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | 9 | option go_package = "nested"; 10 | 11 | message AddReq { 12 | int32 x = 1; 13 | int32 y = 2; 14 | } 15 | 16 | message AddResp { 17 | message Extra { 18 | string message = 1; 19 | } 20 | int32 result = 1; 21 | Extra extra = 2; 22 | } 23 | 24 | message AddError { 25 | AddReq req = 1; 26 | string error = 2; 27 | } 28 | 29 | service CalcService { 30 | rpc add(AddReq) returns (AddResp) { 31 | option (error) = "AddError"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/proto/package/common.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "google/protobuf/descriptor.proto"; 4 | 5 | package common; 6 | 7 | extend google.protobuf.MethodOptions { 8 | string service_method = 51006; 9 | string error = 51007; 10 | } 11 | 12 | extend google.protobuf.ServiceOptions { 13 | string common_error = 51008; 14 | bool auth = 51009; 15 | } 16 | 17 | extend google.protobuf.FieldOptions { 18 | string val_format = 51002; 19 | bool val_required = 51003; 20 | int32 min = 51004; 21 | int32 max = 51005; 22 | } 23 | 24 | message CommonError { 25 | GenericError genericError = 1; 26 | AuthError authError = 2; 27 | ValidateError validateError = 3; 28 | BindError bindError = 4; 29 | } 30 | 31 | message GenericError { string message = 1; } 32 | 33 | message AuthError { string message = 1; } 34 | 35 | message BindError { string message = 1; } 36 | 37 | message ValidateError { repeated FieldError errors = 1; } 38 | 39 | message FieldError { 40 | string fieldName = 1; 41 | ValidateErrorType errorType = 2; 42 | } 43 | 44 | enum ValidateErrorType { 45 | INVALID_EMAIL = 0; 46 | FIELD_REQUIRED = 1; 47 | } 48 | 49 | message Empty {} 50 | -------------------------------------------------------------------------------- /test/proto/package/gopackage_addReq.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | option go_package = "calcsvr"; 8 | 9 | message AddReq { 10 | int32 x = 1; 11 | int32 y = 2; 12 | } 13 | -------------------------------------------------------------------------------- /test/proto/package/gopackage_addReqFull.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | option go_package = "github.com/yoozoo/protoapi/calcsvr"; 8 | 9 | message AddReq { 10 | int32 x = 1; 11 | int32 y = 2; 12 | } 13 | -------------------------------------------------------------------------------- /test/proto/package/gopackage_calc.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "gopackage_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddResp { 14 | int32 result = 1; 15 | } 16 | 17 | message AddError { 18 | AddReq req = 1; 19 | string error = 2; 20 | } 21 | 22 | service CalcService { 23 | option (common.common_error) = "common.CommonError"; 24 | rpc add(AddReq) returns (AddResp) { 25 | option (common.error) = "AddError"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/proto/package/gopackage_calcFull.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "gopackage_addReqFull.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddResp { 14 | int32 result = 1; 15 | } 16 | 17 | message AddError { 18 | AddReq req = 1; 19 | string error = 2; 20 | } 21 | 22 | service CalcService { 23 | option (common.common_error) = "common.CommonError"; 24 | rpc add(AddReq) returns (AddResp) { 25 | option (common.error) = "AddError"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/proto/package/gopackage_calc_warn.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "gopackage_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | option (common.common_error) = "common.CommonError"; 29 | rpc add(AddReq) returns (AddResp) { 30 | option (common.error) = "AddError"; 31 | } 32 | 33 | rpc add2(calcmain.AddReq) returns (AddResp) { 34 | option (common.error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/package/mixpackage_addReq.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | package calc; 8 | option go_package = "calcsvr"; 9 | 10 | message AddReq { 11 | int32 x = 1; 12 | int32 y = 2; 13 | } 14 | -------------------------------------------------------------------------------- /test/proto/package/mixpackage_calc.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "mixpackage_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | option (common.common_error) = "common.CommonError"; 29 | rpc add(AddReq) returns (AddResp) { 30 | option (common.error) = "AddError"; 31 | } 32 | 33 | rpc add2(calc.AddReq) returns (AddResp) { 34 | option (common.error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/package/nopackage_addReq.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | message AddReq { 8 | int32 x = 1; 9 | int32 y = 2; 10 | } 11 | -------------------------------------------------------------------------------- /test/proto/package/nopackage_calc.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "nopackage_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddResp { 14 | int32 result = 1; 15 | } 16 | 17 | message AddError { 18 | AddReq req = 1; 19 | string error = 2; 20 | } 21 | 22 | service CalcService { 23 | option (common.common_error) = "common.CommonError"; 24 | rpc add(AddReq) returns (AddResp) { 25 | option (common.error) = "AddError"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/proto/package/nopackage_calc_warn.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "nopackage_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | option (common.common_error) = "common.CommonError"; 29 | rpc add(AddReq) returns (AddResp) { 30 | option (common.error) = "AddError"; 31 | } 32 | 33 | rpc add2(calcmain.AddReq) returns (AddResp) { 34 | option (common.error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/package/package_addReq.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | package calc; 8 | 9 | message AddReq { 10 | int32 x = 1; 11 | int32 y = 2; 12 | } 13 | -------------------------------------------------------------------------------- /test/proto/package/package_calc._without_commonerror.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "package_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain_without"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | rpc add(AddReq) returns (AddResp) { 29 | option (common.error) = "AddError"; 30 | } 31 | 32 | rpc add2(calc.AddReq) returns (AddResp) { 33 | option (common.error) = "AddError"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/proto/package/package_calc.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "package_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | option (common.common_error) = "common.CommonError"; 29 | rpc add(AddReq) returns (AddResp) { 30 | option (common.error) = "AddError"; 31 | } 32 | 33 | rpc add2(calc.AddReq) returns (AddResp) { 34 | option (common.error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/package/package_calc_commonerror.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | import "package_addReq.proto"; 9 | 10 | package calcmain; 11 | option go_package = "calcsvrmain"; 12 | 13 | message AddReq { 14 | int32 x = 1; 15 | int32 y = 2; 16 | } 17 | 18 | message AddResp { 19 | int32 result = 1; 20 | } 21 | 22 | message AddError { 23 | AddReq req = 1; 24 | string error = 2; 25 | } 26 | 27 | service CalcService { 28 | option (common.common_error) = "CommonError"; 29 | rpc add(AddReq) returns (AddResp) { 30 | option (common.error) = "AddError"; 31 | } 32 | 33 | rpc add2(calc.AddReq) returns (AddResp) { 34 | option (common.error) = "AddError"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/proto/todolist.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "common.proto"; 8 | 9 | package todolist; 10 | 11 | option go_package = "todolistsvr"; 12 | 13 | message Todo { string title = 1; } 14 | 15 | message AddReq { Todo item = 1; } 16 | 17 | message AddResp { int32 count = 1; } 18 | 19 | message listResp { repeated Todo items = 1; } 20 | 21 | message AddError { 22 | AddReq req = 1; 23 | string error = 2; 24 | } 25 | 26 | service TodolistService { 27 | option (common_error) = "CommonError"; 28 | 29 | rpc add(AddReq) returns (AddResp) { 30 | option (error) = "AddError"; 31 | } 32 | 33 | rpc list(Empty) returns (listResp) {} 34 | } 35 | -------------------------------------------------------------------------------- /test/result/go/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/go/.keep -------------------------------------------------------------------------------- /test/result/package/go/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/package/go/.keep -------------------------------------------------------------------------------- /test/result/ts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/ts/.keep -------------------------------------------------------------------------------- /test/result/ts/axios/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/ts/axios/.keep -------------------------------------------------------------------------------- /test/result/ts/fetch/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/ts/fetch/.keep -------------------------------------------------------------------------------- /test/result/ts/wechat/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yoozoo/protoapi/fe53453ed391d06b4f12f26995d4ad09b2e50330/test/result/ts/wechat/.keep -------------------------------------------------------------------------------- /test/simple.proto: -------------------------------------------------------------------------------- 1 | /** 2 | * 这个文件用于生成相关的前后端API代码 3 | * 用protoapi指定此文件生成相关代码 4 | */ 5 | syntax = "proto3"; 6 | 7 | import "protoapi_common.proto"; 8 | 9 | // package 10 | package yoozoo.protoconf.ts; 11 | option java_package = "com.yoozoo.spring"; 12 | 13 | // env list - 环境 14 | message EnvListRequest { 15 | } 16 | 17 | message EnvListResponse { 18 | repeated Env envs = 1; 19 | } 20 | 21 | message Env { 22 | string env_name = 1; 23 | int32 env_id = 2; 24 | } 25 | 26 | message Error { 27 | ErrorCode code = 1; 28 | string message = 2; 29 | } 30 | 31 | enum ErrorCode { 32 | DefaultError = 0; 33 | GeneralError = 1000; 34 | DatabaseError = 1001; 35 | EtcdError = 1002; 36 | SystemError = 1003; 37 | } 38 | 39 | /** 40 | * This service contains all the rpc related with services 41 | * option (service_method) can be "POST" or "GET", if not specified, both post and get methods will be supported 42 | */ 43 | service AppService { 44 | // get env 45 | rpc getEnv (EnvListRequest) returns (EnvListResponse) { 46 | option (error) = "Error"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /test/test_echo.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/labstack/echo" 5 | "github.com/yoozoo/protoapi/test/result/go/echosvr" 6 | ) 7 | 8 | type echoService struct{} 9 | 10 | // Echo just return req 11 | func (s *echoService) Echo(c echo.Context, req *echosvr.Msg) (resp *echosvr.Msg, err error) { 12 | resp = req 13 | 14 | return 15 | } 16 | 17 | func main() { 18 | e := echo.New() 19 | srv := &echoService{} 20 | echosvr.RegisterEchoService(e, srv) 21 | 22 | e.Logger.Fatal(e.Start(":8080")) 23 | } 24 | -------------------------------------------------------------------------------- /test/test_todolist.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/labstack/echo" 5 | "github.com/yoozoo/protoapi/test/result/go/todolistsvr" 6 | ) 7 | 8 | type todolistService struct { 9 | items []*todolistsvr.Todo 10 | } 11 | 12 | func (s *todolistService) Add(c echo.Context, req *todolistsvr.AddReq) (resp *todolistsvr.AddResp, bizError *todolistsvr.AddError, err error) { 13 | if len(s.items) > 4 { 14 | bizError = new(todolistsvr.AddError) 15 | bizError.Req = req 16 | bizError.Error = "Can't add more than 5 todos" 17 | return 18 | } 19 | 20 | if req.Item == nil { 21 | e := new(todolistsvr.CommonError) 22 | err = e 23 | return 24 | } 25 | 26 | s.items = append(s.items, req.Item) 27 | resp = new(todolistsvr.AddResp) 28 | resp.Count = len(s.items) 29 | return 30 | } 31 | 32 | func (s *todolistService) List(c echo.Context, req *todolistsvr.Empty) (resp *todolistsvr.ListResp, err error) { 33 | resp = new(todolistsvr.ListResp) 34 | resp.Items = s.items 35 | return 36 | } 37 | 38 | func main() { 39 | e := echo.New() 40 | 41 | srv := &todolistService{} 42 | todolistsvr.RegisterTodolistService(e, srv) 43 | 44 | e.Logger.Fatal(e.Start(":8080")) 45 | } 46 | -------------------------------------------------------------------------------- /util/error.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | // Die prints error and exit 9 | func Die(err error) { 10 | fmt.Fprintf(os.Stderr, "Error: %s\n", err) 11 | os.Exit(1) 12 | } 13 | -------------------------------------------------------------------------------- /util/misc.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | func IsStrInSlice(str string, slice []string) bool { 4 | for _, s := range slice { 5 | if s == str { 6 | return true 7 | } 8 | } 9 | return false 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/README.md: -------------------------------------------------------------------------------- 1 | # mousetrap 2 | 3 | mousetrap is a tiny library that answers a single question. 4 | 5 | On a Windows machine, was the process invoked by someone double clicking on 6 | the executable file while browsing in explorer? 7 | 8 | ### Motivation 9 | 10 | Windows developers unfamiliar with command line tools will often "double-click" 11 | the executable for a tool. Because most CLI tools print the help and then exit 12 | when invoked without arguments, this is often very frustrating for those users. 13 | 14 | mousetrap provides a way to detect these invocations so that you can provide 15 | more helpful behavior and instructions on how to run the CLI tool. To see what 16 | this looks like, both from an organizational and a technical perspective, see 17 | https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ 18 | 19 | ### The interface 20 | 21 | The library exposes a single interface: 22 | 23 | func StartedByExplorer() (bool) 24 | -------------------------------------------------------------------------------- /vendor/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | 5 | before_install: 6 | - go get github.com/mattn/goveralls 7 | - go get golang.org/x/tools/cmd/cover 8 | script: 9 | - $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | _ "github.com/mattn/go-isatty" 10 | ) 11 | 12 | // NewColorable return new instance of Writer which handle escape sequence. 13 | func NewColorable(file *os.File) io.Writer { 14 | if file == nil { 15 | panic("nil passed instead of *os.File to NewColorable()") 16 | } 17 | 18 | return file 19 | } 20 | 21 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 22 | func NewColorableStdout() io.Writer { 23 | return os.Stdout 24 | } 25 | 26 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 27 | func NewColorableStderr() io.Writer { 28 | return os.Stderr 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable return new instance of Writer which handle escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - tip 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | before_install: 10 | - go get github.com/mattn/goveralls 11 | - go get golang.org/x/tools/cmd/cover 12 | script: 13 | - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5 14 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | 11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 12 | // terminal. This is also always false on this environment. 13 | func IsCygwinTerminal(fd uintptr) bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine,!ppc64,!ppc64le 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build ppc64 ppc64le 3 | 4 | package isatty 5 | 6 | import ( 7 | "unsafe" 8 | 9 | syscall "golang.org/x/sys/unix" 10 | ) 11 | 12 | const ioctlReadTermios = syscall.TCGETS 13 | 14 | // IsTerminal return true if the file descriptor is terminal. 15 | func IsTerminal(fd uintptr) bool { 16 | var termios syscall.Termios 17 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 18 | return err == 0 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 7 | // terminal. This is also always false on this environment. 8 | func IsCygwinTerminal(fd uintptr) bool { 9 | return false 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | # Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore 23 | # swap 24 | [._]*.s[a-w][a-z] 25 | [._]s[a-w][a-z] 26 | # session 27 | Session.vim 28 | # temporary 29 | .netrwhist 30 | *~ 31 | # auto-generated tag files 32 | tags 33 | 34 | *.exe 35 | 36 | cobra.test 37 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.mailmap: -------------------------------------------------------------------------------- 1 | Steve Francia 2 | Bjørn Erik Pedersen 3 | Fabiano Franz 4 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | matrix: 4 | include: 5 | - go: 1.9.4 6 | - go: 1.10.0 7 | - go: tip 8 | allow_failures: 9 | - go: tip 10 | 11 | before_install: 12 | - mkdir -p bin 13 | - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck 14 | - chmod +x bin/shellcheck 15 | script: 16 | - PATH=$PATH:$PWD/bin go test -v ./... 17 | - go build 18 | - diff -u <(echo -n) <(gofmt -d -s .) 19 | - if [ -z $NOVET ]; then 20 | diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); 21 | fi 22 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_notwin.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package cobra 4 | 5 | var preExecHookFn func(*Command) 6 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/cobra/command_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package cobra 4 | 5 | import ( 6 | "os" 7 | "time" 8 | 9 | "github.com/inconshreveable/mousetrap" 10 | ) 11 | 12 | var preExecHookFn = preExecHook 13 | 14 | func preExecHook(c *Command) { 15 | if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { 16 | c.Print(MousetrapHelpText) 17 | time.Sleep(5 * time.Second) 18 | os.Exit(1) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/spf13/pflag/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: go 4 | 5 | go: 6 | - 1.7.3 7 | - 1.8.1 8 | - tip 9 | 10 | matrix: 11 | allow_failures: 12 | - go: tip 13 | 14 | install: 15 | - go get github.com/golang/lint/golint 16 | - export PATH=$GOPATH/bin:$PATH 17 | - go install ./... 18 | 19 | script: 20 | - verify/all.sh -v 21 | - go test ./... 22 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/bytebufferpool/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6 5 | 6 | script: 7 | # build test for supported platforms 8 | - GOOS=linux go build 9 | - GOOS=darwin go build 10 | - GOOS=freebsd go build 11 | - GOOS=windows go build 12 | - GOARCH=386 go build 13 | 14 | # run tests on a standard platform 15 | - go test -v ./... 16 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/bytebufferpool/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/valyala/bytebufferpool.svg)](https://travis-ci.org/valyala/bytebufferpool) 2 | [![GoDoc](https://godoc.org/github.com/valyala/bytebufferpool?status.svg)](http://godoc.org/github.com/valyala/bytebufferpool) 3 | [![Go Report](http://goreportcard.com/badge/valyala/bytebufferpool)](http://goreportcard.com/report/valyala/bytebufferpool) 4 | 5 | # bytebufferpool 6 | 7 | An implementation of a pool of byte buffers with anti-memory-waste protection. 8 | 9 | The pool may waste limited amount of memory due to fragmentation. 10 | This amount equals to the maximum total size of the byte buffers 11 | in concurrent use. 12 | 13 | # Benchmark results 14 | Currently bytebufferpool is fastest and most effective buffer pool written in Go. 15 | 16 | You can find results [here](https://omgnull.github.io/go-benchmark/buffer/). 17 | 18 | # bytebufferpool users 19 | 20 | * [fasthttp](https://github.com/valyala/fasthttp) 21 | * [quicktemplate](https://github.com/valyala/quicktemplate) 22 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/bytebufferpool/doc.go: -------------------------------------------------------------------------------- 1 | // Package bytebufferpool implements a pool of byte buffers 2 | // with anti-fragmentation protection. 3 | // 4 | // The pool may waste limited amount of memory due to fragmentation. 5 | // This amount equals to the maximum total size of the byte buffers 6 | // in concurrent use. 7 | package bytebufferpool 8 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/fasttemplate/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Aliaksandr Valialkin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/fasttemplate/unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package fasttemplate 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | func unsafeBytes2String(b []byte) string { 11 | return *(*string)(unsafe.Pointer(&b)) 12 | } 13 | 14 | func unsafeString2Bytes(s string) []byte { 15 | sh := (*reflect.StringHeader)(unsafe.Pointer(&s)) 16 | bh := reflect.SliceHeader{ 17 | Data: sh.Data, 18 | Len: sh.Len, 19 | Cap: sh.Len, 20 | } 21 | return *(*[]byte)(unsafe.Pointer(&bh)) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/fasttemplate/unsafe_gae.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package fasttemplate 4 | 5 | func unsafeBytes2String(b []byte) string { 6 | return string(b) 7 | } 8 | 9 | func unsafeString2Bytes(s string) []byte { 10 | return []byte(s) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int64(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | --------------------------------------------------------------------------------