Last active
December 19, 2015 13:59
-
-
Save nik-kor/5965677 to your computer and use it in GitHub Desktop.
Revisions
-
nik-kor revised this gist
Jul 10, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ ->thrift -version Thrift version 0.8.0 -> thrift --gen js:node test.thrift #how to generate test_types.js ->node client.js /home/nick/dev/ged_projects/admin-panel-gate/gen-nodejs/test_types.js:11 -
nik-kor revised this gist
Jul 10, 2013 . No changes.There are no files selected for viewing
-
nik-kor created this gist
Jul 10, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ var thrift = require('thrift') , Foo = require('./gen-nodejs/test_types.js'); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ ->node client.js /home/nick/dev/ged_projects/admin-panel-gate/gen-nodejs/test_types.js:11 var foo.Bar = module.exports.foo.Bar = function(args) { ^ SyntaxError: Unexpected token . at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/nick/dev/ged_projects/admin-panel-gate/client.js:19:11) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ namespace js foo struct Bar { 1: optional string name; } service Test { Bar read_bar( 1: string name, 2: i32 some_parameter ); } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ // // Autogenerated by Thrift Compiler (0.8.0) // // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // var Thrift = require('thrift').Thrift; var ttypes = module.exports = {}; if (typeof foo === 'undefined') { foo = {}; } var foo.Bar = module.exports.foo.Bar = function(args) { this.name = null; if (args) { if (args.name !== undefined) { this.name = args.name; } } }; foo.Bar.prototype = {}; foo.Bar.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRING) { this.name = input.readString(); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; foo.Bar.prototype.write = function(output) { output.writeStructBegin('Bar'); if (this.name) { output.writeFieldBegin('name', Thrift.Type.STRING, 1); output.writeString(this.name); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; };