You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by bu...@apache.org on 2014/05/03 00:44:39 UTC
svn commit: r907838 - in /websites/staging/thrift/trunk/content: ./
lib/go.html sitemap.html
Author: buildbot
Date: Fri May 2 22:44:39 2014
New Revision: 907838
Log:
Staging update by buildbot for thrift
Added:
websites/staging/thrift/trunk/content/lib/go.html
Modified:
websites/staging/thrift/trunk/content/ (props changed)
websites/staging/thrift/trunk/content/sitemap.html
Propchange: websites/staging/thrift/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri May 2 22:44:39 2014
@@ -1 +1 @@
-1592084
+1592085
Added: websites/staging/thrift/trunk/content/lib/go.html
==============================================================================
--- websites/staging/thrift/trunk/content/lib/go.html (added)
+++ websites/staging/thrift/trunk/content/lib/go.html Fri May 2 22:44:39 2014
@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+ <meta content="en-us" http-equiv="Content-Language" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <link href="/static/images/favicon.ico" rel="shortcut icon" />
+ <link href="/static/css/style.css" rel="stylesheet" type="text/css" />
+ <link href="/static/css/codehilite.css" rel="stylesheet" type="text/css" />
+ <link href="/static/css/bootstrap.css" media="screen, projection" rel="stylesheet" type="text/css" />
+
+ <script src="/static/js/jquery.min.js"></script>
+ <script src="/static/js/bootstrap-dropdown.js"></script>
+ <script src="/static/js/bootstrap-tab.js"></script>
+
+ <title>Apache Thrift - </title>
+ </head>
+ <body>
+ <div class="navbar">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/">Apache Thrift ™</a>
+ <div class="nav-collapse">
+ <ul class="nav pull-right">
+ <li>
+ <a href="/download">Download</a>
+ </li>
+ <li>
+ <a href="/docs">Documentation</a>
+ </li>
+ <li>
+ <a href="/developers">Developers</a>
+ </li>
+ <li>
+ <a href="/lib">Libraries</a>
+ </li>
+ <li>
+ <a href="/tutorial">Tutorials</a>
+ </li>
+ <li>
+ <a href="/test">Test Suite</a>
+ </li>
+ <li>
+ <a href="/about">About</a>
+ </li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ Apache <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="http://www.apache.org/" target="_blank">Apache Home</a>
+ </li>
+ <li>
+ <a href="http://www.apache.org/licenses/" target="_blank">Apache License v2.0</a>
+ </li>
+ <li>
+ <a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Donate</a>
+ </li>
+ <li>
+ <a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a>
+ </li>
+ <li>
+ <a href="http://www.apache.org/security/" target="_blank">Security</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</div>
+
+ <div class="container">
+ <h1 id="apache-thrift-go-libraries">Apache Thrift Go Libraries</h1>
+<h1 id="using-thrift-with-go">Using Thrift with Go</h1>
+<p>In following Go conventions, we reccomend you use the 'go' tool to install
+Thrift for go.</p>
+<div class="codehilite"><pre>$ <span class="n">go</span> <span class="n">get</span> <span class="n">git</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">org</span><span class="o">/</span><span class="n">thrift</span><span class="p">.</span><span class="n">git</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">go</span><span class="o">/</span><span class="n">thrift</span>
+</pre></div>
+
+
+<p>Will install the last stable release.</p>
+<h1 id="a-note-about-optional-fields">A note about optional fields</h1>
+<p>The thrift-to-Go compiler tries to represent thrift IDL structs as Go structs.
+We must be able to distinguish between optional fields that are set to their
+default value and optional values which are actually unset, so the generated
+code represents optional fields via pointers.</p>
+<p>This is generally intuitive and works well much of the time, but Go does not
+have a syntax for creating a pointer to a constant in a single expression. That
+is, given a struct like</p>
+<div class="codehilite"><pre><span class="n">struct</span> <span class="n">SomeIDLType</span> <span class="p">{</span>
+ <span class="n">OptionalField</span> <span class="o">*</span><span class="n">int32</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>, the following will not compile:</p>
+<div class="codehilite"><pre><span class="n">x</span> <span class="p">:=</span> <span class="o">&</span><span class="n">SomeIDLType</span><span class="p">{</span>
+ <span class="n">OptionalField</span><span class="p">:</span> <span class="o">&</span><span class="p">(</span>3<span class="p">),</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>(Nor is there any other syntax that's built in to the language)</p>
+<p>As such, we provide some helpers that do just this under lib/go/thrift/. E.g.,</p>
+<div class="codehilite"><pre><span class="n">x</span> <span class="p">:=</span> <span class="o">&</span><span class="n">SomeIDLType</span><span class="p">{</span>
+ <span class="n">OptionalField</span><span class="p">:</span> <span class="n">thrift</span><span class="p">.</span><span class="n">Int32Ptr</span><span class="p">(</span>3<span class="p">),</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>And so on. The code generator also creates analogous helpers for user-defined
+typedefs and enums.
+<p class='snippet_footer'>
+ This snippet was generated by Apache Thrift's <strong>source tree docs</strong>:
+ <a href="http://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=lib/go/README.md;hb=HEAD"</a>lib/go/README.md</a>
+</p></p>
+ </div>
+ <div class="container">
+ <hr>
+ <footer class="footer">
+ <div class="row">
+ <div class="span3">
+ <h3>Links</h3>
+ <ul class="unstyled">
+ <li><a href="/download">Download</a></li>
+ <li><a href="/developers">Developers</a></li>
+ <li><a href="/tutorial">Tutorials</a></li>
+ </ul>
+ <ul class="unstyled">
+ <li><a href="/sitemap">Sitemap</a></li>
+ </ul>
+ </div>
+ <div class="span3">
+ <h3>Get Involved</h3>
+ <ul class="unstyled">
+ <li><a href="/mailing">Mailing Lists</a></li>
+ <li><a href="http://issues.apache.org/jira/browse/THRIFT">Issue Tracking</a></li>
+ <li><a href="/docs/HowToContribute">How To Contribute</a></li>
+ </ul>
+ </div>
+ <div class="span6">
+ <a href="http://www.apache.org/"><img src="/static/images/favicon.ico" /></a> Copyright 2014 <a href="http://www.apache.org/">Apache Software Foundation</a>. Licensed under the <a href="http://www.apache.org/licenses/">Apache License v2.0</a>. Apache, Apache Thrift, and the Apache feather logo are trademarks of The Apache Software Foundation.
+ </div>
+ </div>
+
+ </footer>
+</div>
+
+ </body>
+</html>
Modified: websites/staging/thrift/trunk/content/sitemap.html
==============================================================================
--- websites/staging/thrift/trunk/content/sitemap.html (original)
+++ websites/staging/thrift/trunk/content/sitemap.html Fri May 2 22:44:39 2014
@@ -108,6 +108,7 @@
<li><a href="/lib/"></a></li>
<li><a href="/lib/cpp"></a></li>
<li><a href="/lib/csharp"></a></li>
+<li><a href="/lib/go"></a></li>
<li><a href="/lib/js"></a></li>
<li><a href="/mailing">Mailing Lists</a></li>
<li><a href="/test/">Test Readme</a><ul>