-
1index.html
-
571lib/godoc/godocs.js
-
BINlib/godoc/images/treeview-black-line.gif
-
BINlib/godoc/images/treeview-black.gif
-
BINlib/godoc/images/treeview-default-line.gif
-
BINlib/godoc/images/treeview-default.gif
-
BINlib/godoc/images/treeview-gray-line.gif
-
BINlib/godoc/images/treeview-gray.gif
-
2lib/godoc/jquery.js
-
76lib/godoc/jquery.treeview.css
-
39lib/godoc/jquery.treeview.edit.js
-
256lib/godoc/jquery.treeview.js
-
773lib/godoc/style.css
-
474pkg/C/index.html
-
1276pkg/bufio/index.html
-
1239pkg/builtin/index.html
-
1733pkg/bytes/index.html
-
277pkg/crypto/aes/index.html
-
1017pkg/crypto/cipher/index.html
-
328pkg/crypto/des/index.html
-
417pkg/crypto/dsa/index.html
-
347pkg/crypto/ecdsa/index.html
-
450pkg/crypto/elliptic/index.html
-
250pkg/crypto/hmac/index.html
-
744pkg/crypto/index.html
-
313pkg/crypto/md5/index.html
-
321pkg/crypto/rand/index.html
-
329pkg/crypto/rc4/index.html
-
1088pkg/crypto/rsa/index.html
-
313pkg/crypto/sha1/index.html
-
291pkg/crypto/sha256/index.html
-
352pkg/crypto/sha512/index.html
-
302pkg/crypto/subtle/index.html
-
1205pkg/crypto/tls/index.html
-
1602pkg/crypto/x509/index.html
-
545pkg/crypto/x509/pkix/index.html
-
141pkg/database/index.html
-
926pkg/database/sql/driver/index.html
-
1521pkg/database/sql/index.html
-
674pkg/encoding/asn1/index.html
-
1655pkg/encoding/json/index.html
-
288pkg/encoding/pem/index.html
-
1709pkg/encoding/xml/index.html
-
329pkg/errors/index.html
-
1561pkg/flag/index.html
-
1148pkg/fmt/index.html
-
3288pkg/github.com/PuerkitoBio/goquery/index.html
-
130pkg/github.com/PuerkitoBio/index.html
-
196pkg/github.com/Sirupsen/index.html
-
106pkg/github.com/Sirupsen/logrus/examples/basic/index.html
-
106pkg/github.com/Sirupsen/logrus/examples/hook/index.html
-
141pkg/github.com/Sirupsen/logrus/examples/index.html
-
141pkg/github.com/Sirupsen/logrus/hooks/index.html
-
269pkg/github.com/Sirupsen/logrus/hooks/syslog/index.html
-
321pkg/github.com/Sirupsen/logrus/hooks/test/index.html
-
2160pkg/github.com/Sirupsen/logrus/index.html
-
214pkg/github.com/andybalholm/cascadia/fuzz/index.html
-
357pkg/github.com/andybalholm/cascadia/index.html
-
141pkg/github.com/andybalholm/index.html
-
2338pkg/github.com/andygrunwald/go-jira/index.html
-
130pkg/github.com/andygrunwald/index.html
-
141pkg/github.com/beorn7/index.html
-
130pkg/github.com/beorn7/perks/index.html
-
630pkg/github.com/beorn7/perks/quantile/index.html
-
130pkg/github.com/bradfitz/gomemcache/index.html
-
699pkg/github.com/bradfitz/gomemcache/memcache/index.html
-
141pkg/github.com/bradfitz/index.html
-
872pkg/github.com/cenkalti/backoff/index.html
-
130pkg/github.com/cenkalti/index.html
-
1424pkg/github.com/codegangsta/cli/altsrc/index.html
-
3602pkg/github.com/codegangsta/cli/index.html
-
141pkg/github.com/codegangsta/index.html
-
130pkg/github.com/dghubble/go-twitter/index.html
-
3028pkg/github.com/dghubble/go-twitter/twitter/index.html
-
218pkg/github.com/dghubble/index.html
-
220pkg/github.com/dghubble/oauth1/dropbox/index.html
-
106pkg/github.com/dghubble/oauth1/examples/index.html
-
902pkg/github.com/dghubble/oauth1/index.html
-
220pkg/github.com/dghubble/oauth1/tumblr/index.html
-
235pkg/github.com/dghubble/oauth1/twitter/index.html
-
106pkg/github.com/dghubble/sling/examples/index.html
-
858pkg/github.com/dghubble/sling/index.html
-
141pkg/github.com/die-net/index.html
-
351pkg/github.com/die-net/lrucache/index.html
-
297pkg/github.com/die-net/lrucache/twotier/index.html
-
141pkg/github.com/garyburd/index.html
-
130pkg/github.com/garyburd/redigo/index.html
-
2264pkg/github.com/garyburd/redigo/redis/index.html
-
163pkg/github.com/golang/index.html
-
141pkg/github.com/golang/protobuf/index.html
-
2397pkg/github.com/golang/protobuf/proto/index.html
-
615pkg/github.com/golang/protobuf/proto/proto3_proto/index.html
-
7762pkg/github.com/golang/protobuf/proto/testdata/index.html
-
507pkg/github.com/golang/snappy/index.html
-
781pkg/github.com/google/btree/index.html
-
14559pkg/github.com/google/go-github/github/index.html
-
130pkg/github.com/google/go-github/index.html
-
130pkg/github.com/google/go-querystring/index.html
-
348pkg/github.com/google/go-querystring/query/index.html
-
174pkg/github.com/google/index.html
@ -1 +0,0 @@ |
|||
Temp |
@ -0,0 +1,571 @@ |
|||
// Copyright 2012 The Go Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style
|
|||
// license that can be found in the LICENSE file.
|
|||
|
|||
/* A little code to ease navigation of these documents. |
|||
* |
|||
* On window load we: |
|||
* + Bind search box hint placeholder show/hide events (bindSearchEvents) |
|||
* + Generate a table of contents (generateTOC) |
|||
* + Bind foldable sections (bindToggles) |
|||
* + Bind links to foldable sections (bindToggleLinks) |
|||
*/ |
|||
|
|||
(function() { |
|||
'use strict'; |
|||
|
|||
// Mobile-friendly topbar menu
|
|||
$(function() { |
|||
var menu = $('#menu'); |
|||
var menuButton = $('#menu-button'); |
|||
var menuButtonArrow = $('#menu-button-arrow'); |
|||
menuButton.click(function(event) { |
|||
menu.toggleClass('menu-visible'); |
|||
menuButtonArrow.toggleClass('vertical-flip'); |
|||
event.preventDefault(); |
|||
return false; |
|||
}); |
|||
}); |
|||
|
|||
function bindSearchEvents() { |
|||
|
|||
var search = $('#search'); |
|||
if (search.length === 0) { |
|||
return; // no search box
|
|||
} |
|||
|
|||
function clearInactive() { |
|||
if (search.is('.inactive')) { |
|||
search.val(''); |
|||
search.removeClass('inactive'); |
|||
} |
|||
} |
|||
|
|||
function restoreInactive() { |
|||
if (search.val() !== '') { |
|||
return; |
|||
} |
|||
search.val(search.attr('placeholder')); |
|||
search.addClass('inactive'); |
|||
} |
|||
|
|||
search.on('focus', clearInactive); |
|||
search.on('blur', restoreInactive); |
|||
|
|||
restoreInactive(); |
|||
} |
|||
|
|||
/* Generates a table of contents: looks for h2 and h3 elements and generates |
|||
* links. "Decorates" the element with id=="nav" with this table of contents. |
|||
*/ |
|||
function generateTOC() { |
|||
if ($('#manual-nav').length > 0) { |
|||
return; |
|||
} |
|||
|
|||
var nav = $('#nav'); |
|||
if (nav.length === 0) { |
|||
return; |
|||
} |
|||
|
|||
var toc_items = []; |
|||
$(nav).nextAll('h2, h3').each(function() { |
|||
var node = this; |
|||
if (node.id == '') |
|||
node.id = 'tmp_' + toc_items.length; |
|||
var link = $('<a/>').attr('href', '#' + node.id).text($(node).text()); |
|||
var item; |
|||
if ($(node).is('h2')) { |
|||
item = $('<dt/>'); |
|||
} else { // h3
|
|||
item = $('<dd class="indent"/>'); |
|||
} |
|||
item.append(link); |
|||
toc_items.push(item); |
|||
}); |
|||
if (toc_items.length <= 1) { |
|||
return; |
|||
} |
|||
|
|||
var dl1 = $('<dl/>'); |
|||
var dl2 = $('<dl/>'); |
|||
|
|||
var split_index = (toc_items.length / 2) + 1; |
|||
if (split_index < 8) { |
|||
split_index = toc_items.length; |
|||
} |
|||
for (var i = 0; i < split_index; i++) { |
|||
dl1.append(toc_items[i]); |
|||
} |
|||
for (/* keep using i */; i < toc_items.length; i++) { |
|||
dl2.append(toc_items[i]); |
|||
} |
|||
|
|||
var tocTable = $('<table class="unruled"/>').appendTo(nav); |
|||
var tocBody = $('<tbody/>').appendTo(tocTable); |
|||
var tocRow = $('<tr/>').appendTo(tocBody); |
|||
|
|||
// 1st column
|
|||
$('<td class="first"/>').appendTo(tocRow).append(dl1); |
|||
// 2nd column
|
|||
$('<td/>').appendTo(tocRow).append(dl2); |
|||
} |
|||
|
|||
function bindToggle(el) { |
|||
$('.toggleButton', el).click(function() { |
|||
if ($(el).is('.toggle')) { |
|||
$(el).addClass('toggleVisible').removeClass('toggle'); |
|||
} else { |
|||
$(el).addClass('toggle').removeClass('toggleVisible'); |
|||
} |
|||
}); |
|||
} |
|||
function bindToggles(selector) { |
|||
$(selector).each(function(i, el) { |
|||
bindToggle(el); |
|||
}); |
|||
} |
|||
|
|||
function bindToggleLink(el, prefix) { |
|||
$(el).click(function() { |
|||
var href = $(el).attr('href'); |
|||
var i = href.indexOf('#'+prefix); |
|||
if (i < 0) { |
|||
return; |
|||
} |
|||
var id = '#' + prefix + href.slice(i+1+prefix.length); |
|||
if ($(id).is('.toggle')) { |
|||
$(id).find('.toggleButton').first().click(); |
|||
} |
|||
}); |
|||
} |
|||
function bindToggleLinks(selector, prefix) { |
|||
$(selector).each(function(i, el) { |
|||
bindToggleLink(el, prefix); |
|||
}); |
|||
} |
|||
|
|||
function setupDropdownPlayground() { |
|||
if (!$('#page').is('.wide')) { |
|||
return; // don't show on front page
|
|||
} |
|||
var button = $('#playgroundButton'); |
|||
var div = $('#playground'); |
|||
var setup = false; |
|||
button.toggle(function() { |
|||
button.addClass('active'); |
|||
div.show(); |
|||
if (setup) { |
|||
return; |
|||
} |
|||
setup = true; |
|||
playground({ |
|||
'codeEl': $('.code', div), |
|||
'outputEl': $('.output', div), |
|||
'runEl': $('.run', div), |
|||
'fmtEl': $('.fmt', div), |
|||
'shareEl': $('.share', div), |
|||
'shareRedirect': '//play.golang.org/p/' |
|||
}); |
|||
}, |
|||
function() { |
|||
button.removeClass('active'); |
|||
div.hide(); |
|||
}); |
|||
button.show(); |
|||
$('#menu').css('min-width', '+=60'); |
|||
} |
|||
|
|||
function setupInlinePlayground() { |
|||
'use strict'; |
|||
// Set up playground when each element is toggled.
|
|||
$('div.play').each(function (i, el) { |
|||
// Set up playground for this example.
|
|||
var setup = function() { |
|||
var code = $('.code', el); |
|||
playground({ |
|||
'codeEl': code, |
|||
'outputEl': $('.output', el), |
|||
'runEl': $('.run', el), |
|||
'fmtEl': $('.fmt', el), |
|||
'shareEl': $('.share', el), |
|||
'shareRedirect': '//play.golang.org/p/' |
|||
}); |
|||
|
|||
// Make the code textarea resize to fit content.
|
|||
var resize = function() { |
|||
code.height(0); |
|||
var h = code[0].scrollHeight; |
|||
code.height(h+20); // minimize bouncing.
|
|||
code.closest('.input').height(h); |
|||
}; |
|||
code.on('keydown', resize); |
|||
code.on('keyup', resize); |
|||
code.keyup(); // resize now.
|
|||
}; |
|||
|
|||
// If example already visible, set up playground now.
|
|||
if ($(el).is(':visible')) { |
|||
setup(); |
|||
return; |
|||
} |
|||
|
|||
// Otherwise, set up playground when example is expanded.
|
|||
var built = false; |
|||
$(el).closest('.toggle').click(function() { |
|||
// Only set up once.
|
|||
if (!built) { |
|||
setup(); |
|||
built = true; |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
// fixFocus tries to put focus to div#page so that keyboard navigation works.
|
|||
function fixFocus() { |
|||
var page = $('div#page'); |
|||
var topbar = $('div#topbar'); |
|||
page.css('outline', 0); // disable outline when focused
|
|||
page.attr('tabindex', -1); // and set tabindex so that it is focusable
|
|||
$(window).resize(function (evt) { |
|||
// only focus page when the topbar is at fixed position (that is, it's in
|
|||
// front of page, and keyboard event will go to the former by default.)
|
|||
// by focusing page, keyboard event will go to page so that up/down arrow,
|
|||
// space, etc. will work as expected.
|
|||
if (topbar.css('position') == "fixed") |
|||
page.focus(); |
|||
}).resize(); |
|||
} |
|||
|
|||
function toggleHash() { |
|||
var hash = $(window.location.hash); |
|||
if (hash.is('.toggle')) { |
|||
hash.find('.toggleButton').first().click(); |
|||
} |
|||
} |
|||
|
|||
function personalizeInstallInstructions() { |
|||
var prefix = '?download='; |
|||
var s = window.location.search; |
|||
if (s.indexOf(prefix) != 0) { |
|||
// No 'download' query string; bail.
|
|||
return; |
|||
} |
|||
|
|||
var filename = s.substr(prefix.length); |
|||
var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/; |
|||
$('.downloadFilename').text(filename); |
|||
$('.hideFromDownload').hide(); |
|||
var m = filenameRE.exec(filename); |
|||
if (!m) { |
|||
// Can't interpret file name; bail.
|
|||
return; |
|||
} |
|||
|
|||
var os = m[3]; |
|||
var ext = m[6]; |
|||
if (ext != 'tar.gz') { |
|||
$('#tarballInstructions').hide(); |
|||
} |
|||
if (os != 'darwin' || ext != 'pkg') { |
|||
$('#darwinPackageInstructions').hide(); |
|||
} |
|||
if (os != 'windows') { |
|||
$('#windowsInstructions').hide(); |
|||
$('.testUnix').show(); |
|||
$('.testWindows').hide(); |
|||
} else { |
|||
if (ext != 'msi') { |
|||
$('#windowsInstallerInstructions').hide(); |
|||
} |
|||
if (ext != 'zip') { |
|||
$('#windowsZipInstructions').hide(); |
|||
} |
|||
$('.testUnix').hide(); |
|||
$('.testWindows').show(); |
|||
} |
|||
|
|||
var download = "https://storage.googleapis.com/golang/" + filename; |
|||
|
|||
var message = $('<p class="downloading">'+ |
|||
'Your download should begin shortly. '+ |
|||
'If it does not, click <a>this link</a>.</p>'); |
|||
message.find('a').attr('href', download); |
|||
message.insertAfter('#nav'); |
|||
|
|||
window.location = download; |
|||
} |
|||
|
|||
$(document).ready(function() { |
|||
bindSearchEvents(); |
|||
generateTOC(); |
|||
bindToggles(".toggle"); |
|||
bindToggles(".toggleVisible"); |
|||
bindToggleLinks(".exampleLink", "example_"); |
|||
bindToggleLinks(".overviewLink", ""); |
|||
bindToggleLinks(".examplesLink", ""); |
|||
bindToggleLinks(".indexLink", ""); |
|||
setupDropdownPlayground(); |
|||
setupInlinePlayground(); |
|||
fixFocus(); |
|||
setupTypeInfo(); |
|||
setupCallgraphs(); |
|||
toggleHash(); |
|||
personalizeInstallInstructions(); |
|||
|
|||
// godoc.html defines window.initFuncs in the <head> tag, and root.html and
|
|||
// codewalk.js push their on-page-ready functions to the list.
|
|||
// We execute those functions here, to avoid loading jQuery until the page
|
|||
// content is loaded.
|
|||
for (var i = 0; i < window.initFuncs.length; i++) window.initFuncs[i](); |
|||
}); |
|||
|
|||
// -- analysis ---------------------------------------------------------
|
|||
|
|||
// escapeHTML returns HTML for s, with metacharacters quoted.
|
|||
// It is safe for use in both elements and attributes
|
|||
// (unlike the "set innerText, read innerHTML" trick).
|
|||
function escapeHTML(s) { |
|||
return s.replace(/&/g, '&'). |
|||
replace(/\"/g, '"'). |
|||
replace(/\'/g, '''). |
|||
replace(/</g, '<'). |
|||
replace(/>/g, '>'); |
|||
} |
|||
|
|||
// makeAnchor returns HTML for an <a> element, given an anchorJSON object.
|
|||
function makeAnchor(json) { |
|||
var html = escapeHTML(json.Text); |
|||
if (json.Href != "") { |
|||
html = "<a href='" + escapeHTML(json.Href) + "'>" + html + "</a>"; |
|||
} |
|||
return html; |
|||
} |
|||
|
|||
function showLowFrame(html) { |
|||
var lowframe = document.getElementById('lowframe'); |
|||
lowframe.style.height = "200px"; |
|||
lowframe.innerHTML = "<p style='text-align: left;'>" + html + "</p>\n" + |
|||
"<div onclick='hideLowFrame()' style='position: absolute; top: 0; right: 0; cursor: pointer;'>✘</div>" |
|||
}; |
|||
|
|||
document.hideLowFrame = function() { |
|||
var lowframe = document.getElementById('lowframe'); |
|||
lowframe.style.height = "0px"; |
|||
} |
|||
|
|||
// onClickCallers is the onclick action for the 'func' tokens of a
|
|||
// function declaration.
|
|||
document.onClickCallers = function(index) { |
|||
var data = document.ANALYSIS_DATA[index] |
|||
if (data.Callers.length == 1 && data.Callers[0].Sites.length == 1) { |
|||
document.location = data.Callers[0].Sites[0].Href; // jump to sole caller
|
|||
return; |
|||
} |
|||
|
|||
var html = "Callers of <code>" + escapeHTML(data.Callee) + "</code>:<br/>\n"; |
|||
for (var i = 0; i < data.Callers.length; i++) { |
|||
var caller = data.Callers[i]; |
|||
html += "<code>" + escapeHTML(caller.Func) + "</code>"; |
|||
var sites = caller.Sites; |
|||
if (sites != null && sites.length > 0) { |
|||
html += " at line "; |
|||
for (var j = 0; j < sites.length; j++) { |
|||
if (j > 0) { |
|||
html += ", "; |
|||
} |
|||
html += "<code>" + makeAnchor(sites[j]) + "</code>"; |
|||
} |
|||
} |
|||
html += "<br/>\n"; |
|||
} |
|||
showLowFrame(html); |
|||
}; |
|||
|
|||
// onClickCallees is the onclick action for the '(' token of a function call.
|
|||
document.onClickCallees = function(index) { |
|||
var data = document.ANALYSIS_DATA[index] |
|||
if (data.Callees.length == 1) { |
|||
document.location = data.Callees[0].Href; // jump to sole callee
|
|||
return; |
|||
} |
|||
|
|||
var html = "Callees of this " + escapeHTML(data.Descr) + ":<br/>\n"; |
|||
for (var i = 0; i < data.Callees.length; i++) { |
|||
html += "<code>" + makeAnchor(data.Callees[i]) + "</code><br/>\n"; |
|||
} |
|||
showLowFrame(html); |
|||
}; |
|||
|
|||
// onClickTypeInfo is the onclick action for identifiers declaring a named type.
|
|||
document.onClickTypeInfo = function(index) { |
|||
var data = document.ANALYSIS_DATA[index]; |
|||
var html = "Type <code>" + data.Name + "</code>: " + |
|||
" <small>(size=" + data.Size + ", align=" + data.Align + ")</small><br/>\n"; |
|||
html += implementsHTML(data); |
|||
html += methodsetHTML(data); |
|||
showLowFrame(html); |
|||
}; |
|||
|
|||
// implementsHTML returns HTML for the implements relation of the
|
|||
// specified TypeInfoJSON value.
|
|||
function implementsHTML(info) { |
|||
var html = ""; |
|||
if (info.ImplGroups != null) { |
|||
for (var i = 0; i < info.ImplGroups.length; i++) { |
|||
var group = info.ImplGroups[i]; |
|||
var x = "<code>" + escapeHTML(group.Descr) + "</code> "; |
|||
for (var j = 0; j < group.Facts.length; j++) { |
|||
var fact = group.Facts[j]; |
|||
var y = "<code>" + makeAnchor(fact.Other) + "</code>"; |
|||
if (fact.ByKind != null) { |
|||
html += escapeHTML(fact.ByKind) + " type " + y + " implements " + x; |
|||
} else { |
|||
html += x + " implements " + y; |
|||
} |
|||
html += "<br/>\n"; |
|||
} |
|||
} |
|||
} |
|||
return html; |
|||
} |
|||
|
|||
|
|||
// methodsetHTML returns HTML for the methodset of the specified
|
|||
// TypeInfoJSON value.
|
|||
function methodsetHTML(info) { |
|||
var html = ""; |
|||
if (info.Methods != null) { |
|||
for (var i = 0; i < info.Methods.length; i++) { |
|||
html += "<code>" + makeAnchor(info.Methods[i]) + "</code><br/>\n"; |
|||
} |
|||
} |
|||
return html; |
|||
} |
|||
|
|||
// onClickComm is the onclick action for channel "make" and "<-"
|
|||
// send/receive tokens.
|
|||
document.onClickComm = function(index) { |
|||
var ops = document.ANALYSIS_DATA[index].Ops |
|||
if (ops.length == 1) { |
|||
document.location = ops[0].Op.Href; // jump to sole element
|
|||
return; |
|||
} |
|||
|
|||
var html = "Operations on this channel:<br/>\n"; |
|||
for (var i = 0; i < ops.length; i++) { |
|||
html += makeAnchor(ops[i].Op) + " by <code>" + escapeHTML(ops[i].Fn) + "</code><br/>\n"; |
|||
} |
|||
if (ops.length == 0) { |
|||
html += "(none)<br/>\n"; |
|||
} |
|||
showLowFrame(html); |
|||
}; |
|||
|
|||
$(window).load(function() { |
|||
// Scroll window so that first selection is visible.
|
|||
// (This means we don't need to emit id='L%d' spans for each line.)
|
|||
// TODO(adonovan): ideally, scroll it so that it's under the pointer,
|
|||
// but I don't know how to get the pointer y coordinate.
|
|||
var elts = document.getElementsByClassName("selection"); |
|||
if (elts.length > 0) { |
|||
elts[0].scrollIntoView() |
|||
} |
|||
}); |
|||
|
|||
// setupTypeInfo populates the "Implements" and "Method set" toggle for
|
|||
// each type in the package doc.
|
|||
function setupTypeInfo() { |
|||
for (var i in document.ANALYSIS_DATA) { |
|||
var data = document.ANALYSIS_DATA[i]; |
|||
|
|||
var el = document.getElementById("implements-" + i); |
|||
if (el != null) { |
|||
// el != null => data is TypeInfoJSON.
|
|||
if (data.ImplGroups != null) { |
|||
el.innerHTML = implementsHTML(data); |
|||
el.parentNode.parentNode.style.display = "block"; |
|||
} |
|||
} |
|||
|
|||
var el = document.getElementById("methodset-" + i); |
|||
if (el != null) { |
|||
// el != null => data is TypeInfoJSON.
|
|||
if (data.Methods != null) { |
|||
el.innerHTML = methodsetHTML(data); |
|||
el.parentNode.parentNode.style.display = "block"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function setupCallgraphs() { |
|||
if (document.CALLGRAPH == null) { |
|||
return |
|||
} |
|||
document.getElementById("pkg-callgraph").style.display = "block"; |
|||
|
|||
var treeviews = document.getElementsByClassName("treeview"); |
|||
for (var i = 0; i < treeviews.length; i++) { |
|||
var tree = treeviews[i]; |
|||
if (tree.id == null || tree.id.indexOf("callgraph-") != 0) { |
|||
continue; |
|||
} |
|||
var id = tree.id.substring("callgraph-".length); |
|||
$(tree).treeview({collapsed: true, animated: "fast"}); |
|||
document.cgAddChildren(tree, tree, [id]); |
|||
tree.parentNode.parentNode.style.display = "block"; |
|||
} |
|||
} |
|||
|
|||
document.cgAddChildren = function(tree, ul, indices) { |
|||
if (indices != null) { |
|||
for (var i = 0; i < indices.length; i++) { |
|||
var li = cgAddChild(tree, ul, document.CALLGRAPH[indices[i]]); |
|||
if (i == indices.length - 1) { |
|||
$(li).addClass("last"); |
|||
} |
|||
} |
|||
} |
|||
$(tree).treeview({animated: "fast", add: ul}); |
|||
} |
|||
|
|||
// cgAddChild adds an <li> element for document.CALLGRAPH node cgn to
|
|||
// the parent <ul> element ul. tree is the tree's root <ul> element.
|
|||
function cgAddChild(tree, ul, cgn) { |
|||
var li = document.createElement("li"); |
|||
ul.appendChild(li); |
|||
li.className = "closed"; |
|||
|
|||
var code = document.createElement("code"); |
|||
|
|||
if (cgn.Callees != null) { |
|||
$(li).addClass("expandable"); |
|||
|
|||
// Event handlers and innerHTML updates don't play nicely together,
|
|||
// hence all this explicit DOM manipulation.
|
|||
var hitarea = document.createElement("div"); |
|||
hitarea.className = "hitarea expandable-hitarea"; |
|||
li.appendChild(hitarea); |
|||
|
|||
li.appendChild(code); |
|||
|
|||
var childUL = document.createElement("ul"); |
|||
li.appendChild(childUL); |
|||
childUL.setAttribute('style', "display: none;"); |
|||
|
|||
var onClick = function() { |
|||
document.cgAddChildren(tree, childUL, cgn.Callees); |
|||
hitarea.removeEventListener('click', onClick) |
|||
}; |
|||
hitarea.addEventListener('click', onClick); |
|||
|
|||
} else { |
|||
li.appendChild(code); |
|||
} |
|||
code.innerHTML += " " + makeAnchor(cgn.Func); |
|||
return li |
|||
} |
|||
|
|||
})(); |
After Width: 16 | Height: 1776 | Size: 1.8 KiB |
After Width: 96 | Height: 133 | Size: 402 B |
After Width: 16 | Height: 1776 | Size: 1.9 KiB |
After Width: 96 | Height: 133 | Size: 400 B |
After Width: 16 | Height: 1776 | Size: 1.8 KiB |
After Width: 96 | Height: 133 | Size: 411 B |
2
lib/godoc/jquery.js
File diff suppressed because it is too large
View File
@ -0,0 +1,76 @@ |
|||
/* https://github.com/jzaefferer/jquery-treeview/blob/master/jquery.treeview.css */ |
|||
/* License: MIT. */ |
|||
.treeview, .treeview ul { |
|||
padding: 0; |
|||
margin: 0; |
|||
list-style: none; |
|||
} |
|||
|
|||
.treeview ul { |
|||
background-color: white; |
|||
margin-top: 4px; |
|||
} |
|||
|
|||
.treeview .hitarea { |
|||
background: url(images/treeview-default.gif) -64px -25px no-repeat; |
|||
height: 16px; |
|||
width: 16px; |
|||
margin-left: -16px; |
|||
float: left; |
|||
cursor: pointer; |
|||
} |
|||
/* fix for IE6 */ |
|||
* html .hitarea { |
|||
display: inline; |
|||
float:none; |
|||
} |
|||
|
|||
.treeview li { |
|||
margin: 0; |
|||
padding: 3px 0pt 3px 16px; |
|||
} |
|||
|
|||
.treeview a.selected { |
|||
background-color: #eee; |
|||
} |
|||
|
|||
#treecontrol { margin: 1em 0; display: none; } |
|||
|
|||
.treeview .hover { color: red; cursor: pointer; } |
|||
|
|||
.treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; } |
|||
.treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; } |
|||
|
|||
.treeview .expandable-hitarea { background-position: -80px -3px; } |
|||
|
|||
.treeview li.last { background-position: 0 -1766px } |
|||
.treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); } |
|||
.treeview li.lastCollapsable { background-position: 0 -111px } |
|||
.treeview li.lastExpandable { background-position: -32px -67px } |
|||
|
|||
.treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; } |
|||
|
|||
.treeview-red li { background-image: url(http://localhost:6060/lib/godoc/images/treeview-red-line.gif); } |
|||
.treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(http://localhost:6060/lib/godoc/images/treeview-red.gif); } |
|||
|
|||
.treeview-black li { background-image: url(images/treeview-black-line.gif); } |
|||
.treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); } |
|||
|
|||
.treeview-gray li { background-image: url(images/treeview-gray-line.gif); } |
|||
.treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); } |
|||
|
|||
.treeview-famfamfam li { background-image: url(http://localhost:6060/lib/godoc/images/treeview-famfamfam-line.gif); } |
|||
.treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(http://localhost:6060/lib/godoc/images/treeview-famfamfam.gif); } |
|||
|
|||
.treeview .placeholder { |
|||
background: url(http://localhost:6060/lib/godoc/images/ajax-loader.gif) 0 0 no-repeat; |
|||
height: 16px; |
|||
width: 16px; |
|||
display: block; |
|||
} |
|||
|
|||
.filetree li { padding: 3px 0 2px 16px; } |
|||
.filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; } |
|||
.filetree span.folder { background: url(http://localhost:6060/lib/godoc/images/folder.gif) 0 0 no-repeat; } |
|||
.filetree li.expandable span.folder { background: url(http://localhost:6060/lib/godoc/images/folder-closed.gif) 0 0 no-repeat; } |
|||
.filetree span.file { background: url(http://localhost:6060/lib/godoc/images/file.gif) 0 0 no-repeat; } |
@ -0,0 +1,39 @@ |
|||
/* https://github.com/jzaefferer/jquery-treeview/blob/master/jquery.treeview.edit.js */ |
|||
/* License: MIT. */ |
|||
(function($) { |
|||
var CLASSES = $.treeview.classes; |
|||
var proxied = $.fn.treeview; |
|||
$.fn.treeview = function(settings) { |
|||
settings = $.extend({}, settings); |
|||
if (settings.add) { |
|||
return this.trigger("add", [settings.add]); |
|||
} |
|||
if (settings.remove) { |
|||
return this.trigger("remove", [settings.remove]); |
|||
} |
|||
return proxied.apply(this, arguments).bind("add", function(event, branches) { |
|||
$(branches).prev() |
|||
.removeClass(CLASSES.last) |
|||
.removeClass(CLASSES.lastCollapsable) |
|||
.removeClass(CLASSES.lastExpandable) |
|||
.find(">.hitarea") |
|||
.removeClass(CLASSES.lastCollapsableHitarea) |
|||
.removeClass(CLASSES.lastExpandableHitarea); |
|||
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, $(this).data("toggler")); |
|||
}).bind("remove", function(event, branches) { |
|||
var prev = $(branches).prev(); |
|||
var parent = $(branches).parent(); |
|||
$(branches).remove(); |
|||
prev.filter(":last-child").addClass(CLASSES.last) |
|||
.filter("." + CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable).end() |
|||
.find(">.hitarea").replaceClass(CLASSES.expandableHitarea, CLASSES.lastExpandableHitarea).end() |
|||
.filter("." + CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable).end() |
|||
.find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.lastCollapsableHitarea); |
|||
if (parent.is(":not(:has(>))") && parent[0] != this) { |
|||
parent.parent().removeClass(CLASSES.collapsable).removeClass(CLASSES.expandable) |
|||
parent.siblings(".hitarea").andSelf().remove(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
})(jQuery); |
@ -0,0 +1,256 @@ |
|||
/* |
|||
* Treeview 1.4.1 - jQuery plugin to hide and show branches of a tree |
|||
* |
|||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
|||
* http://docs.jquery.com/Plugins/Treeview
|
|||
* |
|||
* Copyright (c) 2007 Jörn Zaefferer |
|||
* |
|||
* Dual licensed under the MIT and GPL licenses: |
|||
* http://www.opensource.org/licenses/mit-license.php
|
|||
* http://www.gnu.org/licenses/gpl.html
|
|||
* |
|||
* Revision: $Id: jquery.treeview.js 5759 2008-07-01 07:50:28Z joern.zaefferer $ |
|||
* |
|||
*/ |
|||
|
|||
;(function($) { |
|||
|
|||
// TODO rewrite as a widget, removing all the extra plugins
|
|||
$.extend($.fn, { |
|||
swapClass: function(c1, c2) { |
|||
var c1Elements = this.filter('.' + c1); |
|||
this.filter('.' + c2).removeClass(c2).addClass(c1); |
|||
c1Elements.removeClass(c1).addClass(c2); |
|||
return this; |
|||
}, |
|||
replaceClass: function(c1, c2) { |
|||
return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); |
|||
}, |
|||
hoverClass: function(className) { |
|||
className = className || "hover"; |
|||
return this.hover(function() { |
|||
$(this).addClass(className); |
|||
}, function() { |
|||
$(this).removeClass(className); |
|||
}); |
|||
}, |
|||
heightToggle: function(animated, callback) { |
|||
animated ? |
|||
this.animate({ height: "toggle" }, animated, callback) : |
|||
this.each(function(){ |
|||
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); |
|||
if(callback) |
|||
callback.apply(this, arguments); |
|||
}); |
|||
}, |
|||
heightHide: function(animated, callback) { |
|||
if (animated) { |
|||
this.animate({ height: "hide" }, animated, callback); |
|||
} else { |
|||
this.hide(); |
|||
if (callback) |
|||
this.each(callback); |
|||
} |
|||
}, |
|||
prepareBranches: function(settings) { |
|||
if (!settings.prerendered) { |
|||
// mark last tree items
|
|||
this.filter(":last-child:not(ul)").addClass(CLASSES.last); |
|||
// collapse whole tree, or only those marked as closed, anyway except those marked as open
|
|||
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); |
|||
} |
|||
// return all items with sublists
|
|||
return this.filter(":has(>ul)"); |
|||
}, |
|||
applyClasses: function(settings, toggler) { |
|||
// TODO use event delegation
|
|||
this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) { |
|||
// don't handle click events on children, eg. checkboxes
|
|||
if ( this == event.target ) |
|||
toggler.apply($(this).next()); |
|||
}).add( $("a", this) ).hoverClass(); |
|||
|
|||
if (!settings.prerendered) { |
|||
// handle closed ones first
|
|||
this.filter(":has(>ul:hidden)") |
|||
.addClass(CLASSES.expandable) |
|||
.replaceClass(CLASSES.last, CLASSES.lastExpandable); |
|||
|
|||
// handle open ones
|
|||
this.not(":has(>ul:hidden)") |
|||
.addClass(CLASSES.collapsable) |
|||
.replaceClass(CLASSES.last, CLASSES.lastCollapsable); |
|||
|
|||
// create hitarea if not present
|
|||
var hitarea = this.find("div." + CLASSES.hitarea); |
|||
if (!hitarea.length) |
|||
hitarea = this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea); |
|||
hitarea.removeClass().addClass(CLASSES.hitarea).each(function() { |
|||
var classes = ""; |
|||
$.each($(this).parent().attr("class").split(" "), function() { |
|||
classes += this + "-hitarea "; |
|||
}); |
|||
$(this).addClass( classes ); |
|||
}) |
|||
} |
|||
|
|||
// apply event to hitarea
|
|||
this.find("div." + CLASSES.hitarea).click( toggler ); |
|||
}, |
|||
treeview: function(settings) { |
|||
|
|||
settings = $.extend({ |
|||
cookieId: "treeview" |
|||
}, settings); |
|||
|
|||
if ( settings.toggle ) { |
|||
var callback = settings.toggle; |
|||
settings.toggle = function() { |
|||
return callback.apply($(this).parent()[0], arguments); |
|||
}; |
|||
} |
|||
|
|||
// factory for treecontroller
|
|||
function treeController(tree, control) { |
|||
// factory for click handlers
|
|||
function handler(filter) { |
|||
return function() { |
|||
// reuse toggle event handler, applying the elements to toggle
|
|||
// start searching for all hitareas
|
|||
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { |
|||
// for plain toggle, no filter is provided, otherwise we need to check the parent element
|
|||
return filter ? $(this).parent("." + filter).length : true; |
|||
}) ); |
|||
return false; |
|||
}; |
|||
} |
|||
// click on first element to collapse tree
|
|||
$("a:eq(0)", control).click( handler(CLASSES.collapsable) ); |
|||
// click on second to expand tree
|
|||
$("a:eq(1)", control).click( handler(CLASSES.expandable) ); |
|||
// click on third to toggle tree
|
|||
$("a:eq(2)", control).click( handler() ); |
|||
} |
|||
|
|||
// handle toggle event
|
|||
function toggler() { |
|||
$(this) |
|||
.parent() |
|||
// swap classes for hitarea
|
|||
.find(">.hitarea") |
|||
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) |
|||
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) |
|||
.end() |
|||
// swap classes for parent li
|
|||
.swapClass( CLASSES.collapsable, CLASSES.expandable ) |
|||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) |
|||
// find child lists
|
|||
.find( ">ul" ) |
|||
// toggle them
|
|||
.heightToggle( settings.animated, settings.toggle ); |
|||
if ( settings.unique ) { |
|||
$(this).parent() |
|||
.siblings() |
|||
// swap classes for hitarea
|
|||
.find(">.hitarea") |
|||
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) |
|||
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) |
|||
.end() |
|||
.replaceClass( CLASSES.collapsable, CLASSES.expandable ) |
|||
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) |
|||
.find( ">ul" ) |
|||
.heightHide( settings.animated, settings.toggle ); |
|||
} |
|||
} |
|||
this.data("toggler", toggler); |
|||
|
|||
function serialize() { |
|||
function binary(arg) { |
|||
return arg ? 1 : 0; |
|||
} |
|||
var data = []; |
|||
branches.each(function(i, e) { |
|||
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; |
|||
}); |
|||
$.cookie(settings.cookieId, data.join(""), settings.cookieOptions ); |
|||
} |
|||
|
|||
function deserialize() { |
|||
var stored = $.cookie(settings.cookieId); |
|||
if ( stored ) { |
|||
var data = stored.split(""); |
|||
branches.each(function(i, e) { |
|||
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
// add treeview class to activate styles
|
|||
this.addClass("treeview"); |
|||
|
|||
// prepare branches and find all tree items with child lists
|
|||
var branches = this.find("li").prepareBranches(settings); |
|||
|
|||
switch(settings.persist) { |
|||
case "cookie": |
|||
var toggleCallback = settings.toggle; |
|||
settings.toggle = function() { |
|||
serialize(); |
|||
if (toggleCallback) { |
|||
toggleCallback.apply(this, arguments); |
|||
} |
|||
}; |
|||
deserialize(); |
|||
break; |
|||
case "location": |
|||
var current = this.find("a").filter(function() { |
|||
return this.href.toLowerCase() == location.href.toLowerCase(); |
|||
}); |
|||
if ( current.length ) { |
|||
// TODO update the open/closed classes
|
|||
var items = current.addClass("selected").parents("ul, li").add( current.next() ).show(); |
|||
if (settings.prerendered) { |
|||
// if prerendered is on, replicate the basic class swapping
|
|||
items.filter("li") |
|||
.swapClass( CLASSES.collapsable, CLASSES.expandable ) |
|||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) |
|||
.find(">.hitarea") |
|||
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) |
|||
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ); |
|||
} |
|||
} |
|||
break; |
|||
} |
|||
|
|||
branches.applyClasses(settings, toggler); |
|||
|
|||
// if control option is set, create the treecontroller and show it
|
|||
if ( settings.control ) { |
|||
treeController(this, settings.control); |
|||
$(settings.control).show(); |
|||
} |
|||
|
|||
return this; |
|||
} |
|||
}); |
|||
|
|||
// classes used by the plugin
|
|||
// need to be styled via external stylesheet, see first example
|
|||
$.treeview = {}; |
|||
var CLASSES = ($.treeview.classes = { |
|||
open: "open", |
|||
closed: "closed", |
|||
expandable: "expandable", |
|||
expandableHitarea: "expandable-hitarea", |
|||
lastExpandableHitarea: "lastExpandable-hitarea", |
|||
collapsable: "collapsable", |
|||
collapsableHitarea: "collapsable-hitarea", |
|||
lastCollapsableHitarea: "lastCollapsable-hitarea", |
|||
lastCollapsable: "lastCollapsable", |
|||
lastExpandable: "lastExpandable", |
|||
last: "last", |
|||
hitarea: "hitarea" |
|||
}); |
|||
|
|||
})(jQuery); |
@ -0,0 +1,773 @@ |
|||
body { |
|||
margin: 0; |
|||
font-family: Arial, sans-serif; |
|||
font-size: 16px; |
|||
background-color: #fff; |
|||
line-height: 1.3em; |
|||
} |
|||
pre, |
|||
code { |
|||
font-family: Menlo, monospace; |
|||
font-size: 14px; |
|||
} |
|||
pre { |
|||
line-height: 1.4em; |
|||
overflow-x: auto; |
|||
} |
|||
pre .comment { |
|||
color: #006600; |
|||
} |
|||
pre .highlight, |
|||
pre .highlight-comment, |
|||
pre .selection-highlight, |
|||
pre .selection-highlight-comment { |
|||
background: #FFFF00; |
|||
} |
|||
pre .selection, |
|||
pre .selection-comment { |
|||
background: #FF9632; |
|||
} |
|||
pre .ln { |
|||
color: #999; |
|||
} |
|||
body { |
|||
color: #222; |
|||
} |
|||
a, |
|||
.exampleHeading .text { |
|||
color: #375EAB; |
|||
text-decoration: none; |
|||
} |
|||
a:hover, |
|||
.exampleHeading .text:hover { |
|||
text-decoration: underline; |
|||
} |
|||
p, li { |
|||
max-width: 800px; |
|||
word-wrap: break-word; |
|||
} |
|||
p, |
|||
pre, |
|||
ul, |
|||
ol { |
|||
margin: 20px; |
|||
} |
|||
pre { |
|||
background: #EFEFEF; |
|||
padding: 10px; |
|||
|
|||
-webkit-border-radius: 5px; |
|||
-moz-border-radius: 5px; |
|||
border-radius: 5px; |
|||
} |
|||
|
|||
h1, |
|||
h2, |
|||
h3, |
|||
h4, |
|||
.rootHeading { |
|||
margin: 20px 0 20px; |
|||
padding: 0; |
|||
color: #375EAB; |
|||
font-weight: bold; |
|||
} |
|||
h1 { |
|||
font-size: 28px; |
|||
line-height: 1; |
|||
} |
|||
h2 { |
|||
font-size: 20px; |
|||
background: #E0EBF5; |
|||
padding: 8px; |
|||
line-height: 1.25; |
|||
font-weight: normal; |
|||
} |
|||
h2 a { |
|||
font-weight: bold; |
|||
} |
|||
h3 { |
|||
font-size: 20px; |
|||
} |
|||
h3, |
|||
h4 { |
|||
margin: 20px 5px; |
|||
} |
|||
h4 { |
|||
font-size: 16px; |
|||
} |
|||
.rootHeading { |
|||
font-size: 20px; |
|||
margin: 0; |
|||
} |
|||
|
|||
dl { |
|||
margin: 20px; |
|||
} |
|||
dd { |
|||
margin: 0 0 0 20px; |
|||
} |
|||
dl, |
|||
dd { |
|||
font-size: 14px; |
|||
} |
|||
div#nav table td { |
|||
vertical-align: top; |
|||
} |
|||
|
|||
|
|||
.pkg-dir { |
|||
padding: 0 10px; |
|||
} |
|||
.pkg-dir table { |
|||
border-collapse: collapse; |
|||
border-spacing: 0; |
|||
} |
|||
.pkg-name { |
|||
padding-right: 10px; |
|||
} |
|||
.alert { |
|||
color: #AA0000; |
|||
} |
|||
|
|||
.top-heading { |
|||
float: left; |
|||
padding: 21px 0; |
|||
font-size: 20px; |
|||
font-weight: normal; |
|||
} |
|||
.top-heading a { |
|||
color: #222; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
div#topbar { |
|||
background: #E0EBF5; |
|||
height: 64px; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
body { |
|||
text-align: center; |
|||
} |
|||
div#page { |
|||
width: 100%; |
|||
} |
|||
div#page > .container, |
|||
div#topbar > .container { |
|||
text-align: left; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
padding: 0 20px; |
|||
} |
|||
div#topbar > .container, |
|||
div#page > .container { |
|||
max-width: 950px; |
|||
} |
|||
div#page.wide > .container, |
|||
div#topbar.wide > .container { |
|||
max-width: none; |
|||
} |
|||
div#plusone { |
|||
float: right; |
|||
clear: right; |
|||
margin-top: 5px; |
|||
} |
|||
|
|||
div#footer { |
|||
text-align: center; |
|||
color: #666; |
|||
font-size: 14px; |
|||
margin: 40px 0; |
|||
} |
|||
|
|||
div#menu > a, |
|||
div#menu > input, |
|||
div#learn .buttons a, |
|||
div.play .buttons a, |
|||
div#blog .read a, |
|||
#menu-button { |
|||
padding: 10px; |
|||
|
|||
text-decoration: none; |
|||
font-size: 16px; |
|||
|
|||
-webkit-border-radius: 5px; |
|||
-moz-border-radius: 5px; |
|||
border-radius: 5px; |
|||
} |
|||
div#playground .buttons a, |
|||
div#menu > a, |
|||
div#menu > input, |
|||
#menu-button { |
|||
border: 1px solid #375EAB; |
|||
} |
|||
div#playground .buttons a, |
|||
div#menu > a, |
|||
#menu-button { |
|||
color: white; |
|||
background: #375EAB; |
|||
} |
|||
#playgroundButton.active { |
|||
background: white; |
|||
color: #375EAB; |
|||
} |
|||
a#start, |
|||
div#learn .buttons a, |
|||
div.play .buttons a, |
|||
div#blog .read a { |
|||
color: #222; |
|||
border: 1px solid #375EAB; |
|||
background: #E0EBF5; |
|||
} |
|||
.download { |
|||
width: 150px; |
|||
} |
|||
|
|||
div#menu { |
|||
text-align: right; |
|||
padding: 10px; |
|||
white-space: nowrap; |
|||
max-height: 0; |
|||
-moz-transition: max-height .25s linear; |
|||
transition: max-height .25s linear; |
|||
width: 100%; |
|||
} |
|||
div#menu.menu-visible { |
|||
max-height: 500px; |
|||
} |
|||
div#menu > a, |
|||
#menu-button { |
|||
margin: 10px 2px; |
|||
padding: 10px; |
|||
} |
|||
div#menu > input { |
|||
position: relative; |
|||
top: 1px; |
|||
width: 140px; |
|||
background: white; |
|||
color: #222; |
|||
box-sizing: border-box; |
|||
} |
|||
div#menu > input.inactive { |
|||
color: #999; |
|||
} |
|||
|
|||
#menu-button { |
|||
display: none; |
|||
position: absolute; |
|||
right: 5px; |
|||
top: 0; |
|||
margin-right: 5px; |
|||
} |
|||
#menu-button-arrow { |
|||
display: inline-block; |
|||
} |
|||
.vertical-flip { |
|||
transform: rotate(-180deg); |
|||
} |
|||
|
|||
div.left { |
|||
float: left; |
|||
clear: left; |
|||
margin-right: 2.5%; |
|||
} |
|||
div.right { |
|||
float: right; |
|||
clear: right; |
|||
margin-left: 2.5%; |
|||
} |
|||
div.left, |
|||
div.right { |
|||
width: 45%; |
|||
} |
|||
|
|||
div#learn, |
|||
div#about { |
|||
padding-top: 20px; |
|||
} |
|||
div#learn h2, |
|||
div#about { |
|||
margin: 0; |
|||
} |
|||
div#about { |
|||
font-size: 20px; |
|||
margin: 0 auto 30px; |
|||
} |
|||
div#gopher { |
|||
background: url(http://localhost:6060/doc/gopher/frontpage.png) no-repeat; |
|||
background-position: center top; |
|||
height: 155px; |
|||
} |
|||
a#start { |
|||
display: block; |
|||
padding: 10px; |
|||
|
|||
text-align: center; |
|||
text-decoration: none; |
|||
|
|||
-webkit-border-radius: 5px; |
|||
-moz-border-radius: 5px; |
|||
border-radius: 5px; |
|||
} |
|||
a#start .big { |
|||
display: block; |
|||
font-weight: bold; |
|||
font-size: 20px; |
|||
} |
|||
a#start .desc { |
|||
display: block; |
|||
font-size: 14px; |
|||
font-weight: normal; |
|||
margin-top: 5px; |
|||
} |
|||
|
|||
div#learn .popout { |
|||
float: right; |
|||
display: block; |
|||
cursor: pointer; |
|||
font-size: 12px; |
|||
background: url(http://localhost:6060/doc/share.png) no-repeat; |
|||
background-position: right top; |
|||
padding: 5px 27px; |
|||
} |
|||
div#learn pre, |
|||
div#learn textarea { |
|||
padding: 0; |
|||
margin: 0; |
|||
font-family: Menlo, monospace; |
|||
font-size: 14px; |
|||
} |
|||
div#learn .input { |
|||
padding: 10px; |
|||
margin-top: 10px; |
|||
height: 150px; |
|||
|
|||
-webkit-border-top-left-radius: 5px; |
|||
-webkit-border-top-right-radius: 5px; |
|||
-moz-border-radius-topleft: 5px; |
|||
-moz-border-radius-topright: 5px; |
|||
border-top-left-radius: 5px; |
|||
border-top-right-radius: 5px; |
|||
} |
|||
div#learn .input textarea { |
|||
width: 100%; |
|||
height: 100%; |
|||
border: none; |
|||
outline: none; |
|||
resize: none; |
|||
} |
|||
div#learn .output { |
|||
border-top: none !important; |
|||
|
|||
padding: 10px; |
|||
height: 59px; |
|||
overflow: auto; |
|||
|
|||
-webkit-border-bottom-right-radius: 5px; |
|||
-webkit-border-bottom-left-radius: 5px; |
|||
-moz-border-radius-bottomright: 5px; |
|||
-moz-border-radius-bottomleft: 5px; |
|||
border-bottom-right-radius: 5px; |
|||
border-bottom-left-radius: 5px; |
|||
} |
|||
div#learn .output pre { |
|||
padding: 0; |
|||
|
|||
-webkit-border-radius: 0; |
|||
-moz-border-radius: 0; |
|||
border-radius: 0; |
|||
} |
|||
div#learn .input, |
|||
div#learn .input textarea, |
|||
div#learn .output, |
|||
div#learn .output pre { |
|||
background: #FFFFD8; |
|||
} |
|||
div#learn .input, |
|||
div#learn .output { |
|||
border: 1px solid #375EAB; |
|||
} |
|||
div#learn .buttons { |
|||
float: right; |
|||
padding: 20px 0 10px 0; |
|||
text-align: right; |
|||
} |
|||
div#learn .buttons a { |
|||
height: 16px; |
|||
margin-left: 5px; |
|||
padding: 10px; |
|||
} |
|||
div#learn .toys { |
|||
margin-top: 8px; |
|||
} |
|||
div#learn .toys select { |
|||
border: 1px solid #375EAB; |
|||
margin: 0; |
|||
} |
|||
div#learn .output .exit { |
|||
display: none; |
|||
} |
|||
|
|||
div#video { |
|||
max-width: 100%; |
|||
} |
|||
div#blog, |
|||
div#video { |
|||
margin-top: 40px; |
|||
} |
|||
div#blog > a, |
|||
div#blog > div, |
|||
div#blog > h2, |
|||
div#video > a, |
|||
div#video > div, |
|||
div#video > h2 { |
|||
margin-bottom: 10px; |
|||
} |
|||
div#blog .title, |
|||
div#video .title { |
|||
display: block; |
|||
font-size: 20px; |
|||
} |
|||
div#blog .when { |
|||
color: #666; |
|||
font-size: 14px; |
|||
} |
|||
div#blog .read { |
|||
text-align: right; |
|||
} |
|||
|
|||
.toggleButton { cursor: pointer; } |
|||
.toggle .collapsed { display: block; } |
|||
.toggle .expanded { display: none; } |
|||
.toggleVisible .collapsed { display: none; } |
|||
.toggleVisible .expanded { display: block; } |
|||
|
|||
table.codetable { margin-left: auto; margin-right: auto; border-style: none; } |
|||
table.codetable td { padding-right: 10px; } |
|||
hr { border-style: none; border-top: 1px solid black; } |
|||
|
|||
img.gopher { |
|||
float: right; |
|||
margin-left: 10px; |
|||
margin-bottom: 10px; |
|||
z-index: -1; |
|||
} |
|||
h2 { clear: right; } |
|||
|
|||
/* example and drop-down playground */ |
|||
div.play { |
|||
padding: 0 20px 40px 20px; |
|||
} |
|||
div.play pre, |
|||
div.play textarea, |
|||
div.play .lines { |
|||
padding: 0; |
|||
margin: 0; |
|||
font-family: Menlo, monospace; |
|||
font-size: 14px; |
|||
} |
|||
div.play .input { |
|||
padding: 10px; |
|||
margin-top: 10px; |
|||
|
|||
-webkit-border-top-left-radius: 5px; |
|||
-webkit-border-top-right-radius: 5px; |
|||
-moz-border-radius-topleft: 5px; |
|||
-moz-border-radius-topright: 5px; |
|||
border-top-left-radius: 5px; |
|||
border-top-right-radius: 5px; |
|||
|
|||
overflow: hidden; |
|||
} |
|||
div.play .input textarea { |
|||
width: 100%; |
|||
height: 100%; |
|||
border: none; |
|||
outline: none; |
|||
resize: none; |
|||
|
|||
overflow: hidden; |
|||
} |
|||
div#playground .input textarea { |
|||
overflow: auto; |
|||
resize: auto; |
|||
} |
|||
div.play .output { |
|||
border-top: none !important; |
|||
|
|||
padding: 10px; |
|||
max-height: 200px; |
|||
overflow: auto; |
|||
|
|||
-webkit-border-bottom-right-radius: 5px; |
|||
-webkit-border-bottom-left-radius: 5px; |
|||
-moz-border-radius-bottomright: 5px; |
|||
-moz-border-radius-bottomleft: 5px; |
|||
border-bottom-right-radius: 5px; |
|||
border-bottom-left-radius: 5px; |
|||
} |
|||
div.play .output pre { |
|||
padding: 0; |
|||
|
|||
-webkit-border-radius: 0; |
|||
-moz-border-radius: 0; |
|||
border-radius: 0; |
|||
} |
|||
div.play .input, |
|||
div.play .input textarea, |
|||
div.play .output, |
|||
div.play .output pre { |
|||
background: #FFFFD8; |
|||
} |
|||
div.play .input, |
|||
div.play .output { |
|||
border: 1px solid #375EAB; |
|||
} |
|||
div.play .buttons { |
|||
float: right; |
|||
padding: 20px 0 10px 0; |
|||
text-align: right; |
|||
} |
|||
div.play .buttons a { |
|||
height: 16px; |
|||
margin-left: 5px; |
|||
padding: 10px; |
|||
cursor: pointer; |
|||
} |
|||
.output .stderr { |
|||
color: #933; |
|||
} |
|||
.output .system { |
|||
color: #999; |
|||
} |
|||
|
|||
/* drop-down playground */ |
|||
#playgroundButton, |
|||
div#playground { |
|||
/* start hidden; revealed by javascript */ |
|||
display: none; |
|||
} |
|||
div#playground { |
|||
position: absolute; |
|||
top: 63px; |
|||
right: 20px; |
|||
padding: 0 10px 10px 10px; |
|||
z-index: 1; |
|||
text-align: left; |
|||
background: #E0EBF5; |
|||
|
|||
border: 1px solid #B0BBC5; |
|||
border-top: none; |
|||
|
|||
-webkit-border-bottom-left-radius: 5px; |
|||
-webkit-border-bottom-right-radius: 5px; |
|||
-moz-border-radius-bottomleft: 5px; |
|||
-moz-border-radius-bottomright: 5px; |
|||
border-bottom-left-radius: 5px; |
|||
border-bottom-right-radius: 5px; |
|||
} |
|||
div#playground .code { |
|||
width: 520px; |
|||
height: 200px; |
|||
} |
|||
div#playground .output { |
|||
height: 100px; |
|||
} |
|||
|
|||
/* Inline runnable snippets (play.js/initPlayground) */ |
|||
#content .code pre, #content .playground pre, #content .output pre { |
|||
margin: 0; |
|||
padding: 0; |
|||
background: none; |
|||
border: none; |
|||
outline: 0px solid transparent; |
|||
overflow: auto; |
|||
} |
|||
#content .playground .number, #content .code .number { |
|||
color: #999; |
|||
} |
|||
#content .code, #content .playground, #content .output { |
|||
width: auto; |
|||
margin: 20px; |
|||
padding: 10px; |
|||
-webkit-border-radius: 5px; |
|||
-moz-border-radius: 5px; |
|||
border-radius: 5px; |
|||
} |
|||
#content .code, #content .playground { |
|||
background: #e9e9e9; |
|||
} |
|||
#content .output { |
|||
background: #202020; |
|||
} |
|||
#content .output .stdout, #content .output pre { |
|||
color: #e6e6e6; |
|||
} |
|||
#content .output .stderr, #content .output .error { |
|||
color: rgb(244, 74, 63); |
|||
} |
|||
#content .output .system, #content .output .exit { |
|||
color: rgb(255, 209, 77) |
|||
} |
|||
#content .buttons { |
|||
position: relative; |
|||
float: right; |
|||
top: -50px; |
|||
right: 30px; |
|||
} |
|||
#content .output .buttons { |
|||
top: -60px; |
|||
right: 0; |
|||
height: 0; |
|||
} |
|||
#content .buttons .kill { |
|||
display: none; |
|||
visibility: hidden; |
|||
} |
|||
a.error { |
|||
font-weight: bold; |
|||
color: white; |
|||
background-color: darkred; |
|||
border-bottom-left-radius: 4px; |
|||
border-bottom-right-radius: 4px; |
|||
border-top-left-radius: 4px; |
|||
border-top-right-radius: 4px; |
|||
padding: 2px 4px 2px 4px; /* TRBL */ |
|||
} |
|||
|
|||
|
|||
#heading-narrow { |
|||
display: none; |
|||
} |
|||
|
|||
.downloading { |
|||
background: #F9F9BE; |
|||
padding: 10px; |
|||
text-align: center; |
|||
border-radius: 5px; |
|||
} |
|||
|
|||
@media (max-width: 930px) { |
|||
#heading-wide { |
|||
display: none; |
|||
} |
|||
#heading-narrow { |
|||
display: block; |
|||
} |
|||
} |
|||
|
|||
|
|||
@media (max-width: 760px) { |
|||
.container .left, |
|||
.container .right { |
|||
width: auto; |
|||
float: none; |
|||
} |
|||
|
|||
div#about { |
|||
max-width: 500px; |
|||
text-align: center; |
|||
} |
|||
} |
|||
|
|||
@media (min-width: 700px) and (max-width: 1000px) { |
|||
div#menu > a { |
|||
margin: 5px 0; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
div#menu > input { |
|||
font-size: 14px; |
|||
} |
|||
} |
|||
|
|||
@media (max-width: 700px) { |
|||
body { |
|||
font-size: 15px; |
|||
} |
|||
|
|||
pre, |
|||
code { |
|||
font-size: 13px; |
|||
} |
|||
|
|||
div#page > .container { |
|||
padding: 0 10px; |
|||
} |
|||
|
|||
div#topbar { |
|||
height: auto; |
|||
padding: 10px; |
|||
} |
|||
|
|||
div#topbar > .container { |
|||
padding: 0; |
|||
} |
|||
|
|||
#heading-wide { |
|||
display: block; |
|||
} |
|||
#heading-narrow { |
|||
display: none; |
|||
} |
|||
|
|||
.top-heading { |
|||
float: none; |
|||
display: inline-block; |
|||
padding: 12px; |
|||
} |
|||
|
|||
div#menu { |
|||
padding: 0; |
|||
min-width: 0; |
|||
text-align: left; |
|||
float: left; |
|||
} |
|||
|
|||
div#menu > a, |
|||
div#menu > input { |
|||
display: block; |
|||
margin-left: 0; |
|||
margin-right: 0; |
|||
} |
|||
|
|||
div#menu > input { |
|||
width: 100%; |
|||
} |
|||
|
|||
#menu-button { |
|||
display: inline-block; |
|||
} |
|||
|
|||
p, |
|||
pre, |
|||
ul, |
|||
ol { |
|||
margin: 10px; |
|||
} |
|||
|
|||
.pkg-synopsis { |
|||
display: none; |
|||
} |
|||
|
|||
img.gopher { |
|||
display: none; |
|||
} |
|||
} |
|||
|
|||
@media (max-width: 480px) { |
|||
#heading-wide { |
|||
display: none; |
|||
} |
|||
#heading-narrow { |
|||
display: block; |
|||
} |
|||
} |
|||
|
|||
@media print { |
|||
pre { |
|||
background: #FFF; |
|||
border: 1px solid #BBB; |
|||
white-space: pre-wrap; |
|||
} |
|||
} |
@ -0,0 +1,474 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>cgo - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Command cgo</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<p> |
|||
Cgo enables the creation of Go packages that call C code. |
|||
</p> |
|||
<h3 id="hdr-Using_cgo_with_the_go_command">Using cgo with the go command</h3> |
|||
<p> |
|||
To use cgo write normal Go code that imports a pseudo-package "C". |
|||
The Go code can then refer to types such as C.size_t, variables such |
|||
as C.stdout, or functions such as C.putchar. |
|||
</p> |
|||
<p> |
|||
If the import of "C" is immediately preceded by a comment, that |
|||
comment, called the preamble, is used as a header when compiling |
|||
the C parts of the package. For example: |
|||
</p> |
|||
<pre>// #include <stdio.h> |
|||
// #include <errno.h> |
|||
import "C" |
|||
</pre> |
|||
<p> |
|||
The preamble may contain any C code, including function and variable |
|||
declarations and definitions. These may then be referred to from Go |
|||
code as though they were defined in the package "C". All names |
|||
declared in the preamble may be used, even if they start with a |
|||
lower-case letter. Exception: static variables in the preamble may |
|||
not be referenced from Go code; static functions are permitted. |
|||
</p> |
|||
<p> |
|||
See $GOROOT/misc/cgo/stdio and $GOROOT/misc/cgo/gmp for examples. See |
|||
"C? Go? Cgo!" for an introduction to using cgo: |
|||
<a href="https://golang.org/doc/articles/c_go_cgo.html">https://golang.org/doc/articles/c_go_cgo.html</a>. |
|||
</p> |
|||
<p> |
|||
CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS may be defined with pseudo #cgo |
|||
directives within these comments to tweak the behavior of the C or C++ |
|||
compiler. Values defined in multiple directives are concatenated |
|||
together. The directive can include a list of build constraints limiting its |
|||
effect to systems satisfying one of the constraints |
|||
(see <a href="https://golang.org/pkg/go/build/#hdr-Build_Constraints">https://golang.org/pkg/go/build/#hdr-Build_Constraints</a> for details about the constraint syntax). |
|||
For example: |
|||
</p> |
|||
<pre>// #cgo CFLAGS: -DPNG_DEBUG=1 |
|||
// #cgo amd64 386 CFLAGS: -DX86=1 |
|||
// #cgo LDFLAGS: -lpng |
|||
// #include <png.h> |
|||
import "C" |
|||
</pre> |
|||
<p> |
|||
Alternatively, CPPFLAGS and LDFLAGS may be obtained via the pkg-config |
|||
tool using a '#cgo pkg-config:' directive followed by the package names. |
|||
For example: |
|||
</p> |
|||
<pre>// #cgo pkg-config: png cairo |
|||
// #include <png.h> |
|||
import "C" |
|||
</pre> |
|||
<p> |
|||
When building, the CGO_CFLAGS, CGO_CPPFLAGS, CGO_CXXFLAGS and |
|||
CGO_LDFLAGS environment variables are added to the flags derived from |
|||
these directives. Package-specific flags should be set using the |
|||
directives, not the environment variables, so that builds work in |
|||
unmodified environments. |
|||
</p> |
|||
<p> |
|||
All the cgo CPPFLAGS and CFLAGS directives in a package are concatenated and |
|||
used to compile C files in that package. All the CPPFLAGS and CXXFLAGS |
|||
directives in a package are concatenated and used to compile C++ files in that |
|||
package. All the LDFLAGS directives in any package in the program are |
|||
concatenated and used at link time. All the pkg-config directives are |
|||
concatenated and sent to pkg-config simultaneously to add to each appropriate |
|||
set of command-line flags. |
|||
</p> |
|||
<p> |
|||
When the cgo directives are parsed, any occurrence of the string ${SRCDIR} |
|||
will be replaced by the absolute path to the directory containing the source |
|||
file. This allows pre-compiled static libraries to be included in the package |
|||
directory and linked properly. |
|||
For example if package foo is in the directory /go/src/foo: |
|||
</p> |
|||
<pre>// #cgo LDFLAGS: -L${SRCDIR}/libs -lfoo |
|||
</pre> |
|||
<p> |
|||
Will be expanded to: |
|||
</p> |
|||
<pre>// #cgo LDFLAGS: -L/go/src/foo/libs -lfoo |
|||
</pre> |
|||
<p> |
|||
When the Go tool sees that one or more Go files use the special import |
|||
"C", it will look for other non-Go files in the directory and compile |
|||
them as part of the Go package. Any .c, .s, or .S files will be |
|||
compiled with the C compiler. Any .cc, .cpp, or .cxx files will be |
|||
compiled with the C++ compiler. Any .h, .hh, .hpp, or .hxx files will |
|||
not be compiled separately, but, if these header files are changed, |
|||
the C and C++ files will be recompiled. The default C and C++ |
|||
compilers may be changed by the CC and CXX environment variables, |
|||
respectively; those environment variables may include command line |
|||
options. |
|||
</p> |
|||
<p> |
|||
The cgo tool is enabled by default for native builds on systems where |
|||
it is expected to work. It is disabled by default when |
|||
cross-compiling. You can control this by setting the CGO_ENABLED |
|||
environment variable when running the go tool: set it to 1 to enable |
|||
the use of cgo, and to 0 to disable it. The go tool will set the |
|||
build constraint "cgo" if cgo is enabled. |
|||
</p> |
|||
<p> |
|||
When cross-compiling, you must specify a C cross-compiler for cgo to |
|||
use. You can do this by setting the CC_FOR_TARGET environment |
|||
variable when building the toolchain using make.bash, or by setting |
|||
the CC environment variable any time you run the go tool. The |
|||
CXX_FOR_TARGET and CXX environment variables work in a similar way for |
|||
C++ code. |
|||
</p> |
|||
<h3 id="hdr-Go_references_to_C">Go references to C</h3> |
|||
<p> |
|||
Within the Go file, C's struct field names that are keywords in Go |
|||
can be accessed by prefixing them with an underscore: if x points at a C |
|||
struct with a field named "type", x._type accesses the field. |
|||
C struct fields that cannot be expressed in Go, such as bit fields |
|||
or misaligned data, are omitted in the Go struct, replaced by |
|||
appropriate padding to reach the next field or the end of the struct. |
|||
</p> |
|||
<p> |
|||
The standard C numeric types are available under the names |
|||
C.char, C.schar (signed char), C.uchar (unsigned char), |
|||
C.short, C.ushort (unsigned short), C.int, C.uint (unsigned int), |
|||
C.long, C.ulong (unsigned long), C.longlong (long long), |
|||
C.ulonglong (unsigned long long), C.float, C.double, |
|||
C.complexfloat (complex float), and C.complexdouble (complex double). |
|||
The C type void* is represented by Go's unsafe.Pointer. |
|||
The C types __int128_t and __uint128_t are represented by [16]byte. |
|||
</p> |
|||
<p> |
|||
To access a struct, union, or enum type directly, prefix it with |
|||
struct_, union_, or enum_, as in C.struct_stat. |
|||
</p> |
|||
<p> |
|||
The size of any C type T is available as C.sizeof_T, as in |
|||
C.sizeof_struct_stat. |
|||
</p> |
|||
<p> |
|||
As Go doesn't have support for C's union type in the general case, |
|||
C's union types are represented as a Go byte array with the same length. |
|||
</p> |
|||
<p> |
|||
Go structs cannot embed fields with C types. |
|||
</p> |
|||
<p> |
|||
Go code can not refer to zero-sized fields that occur at the end of |
|||
non-empty C structs. To get the address of such a field (which is the |
|||
only operation you can do with a zero-sized field) you must take the |
|||
address of the struct and add the size of the struct. |
|||
</p> |
|||
<p> |
|||
Cgo translates C types into equivalent unexported Go types. |
|||
Because the translations are unexported, a Go package should not |
|||
expose C types in its exported API: a C type used in one Go package |
|||
is different from the same C type used in another. |
|||
</p> |
|||
<p> |
|||
Any C function (even void functions) may be called in a multiple |
|||
assignment context to retrieve both the return value (if any) and the |
|||
C errno variable as an error (use _ to skip the result value if the |
|||
function returns void). For example: |
|||
</p> |
|||
<pre>n, err := C.sqrt(-1) |
|||
_, err := C.voidFunc() |
|||
</pre> |
|||
<p> |
|||
Calling C function pointers is currently not supported, however you can |
|||
declare Go variables which hold C function pointers and pass them |
|||
back and forth between Go and C. C code may call function pointers |
|||
received from Go. For example: |
|||
</p> |
|||
<pre>package main |
|||
|
|||
// typedef int (*intFunc) (); |
|||
// |
|||
// int |
|||
// bridge_int_func(intFunc f) |
|||
// { |
|||
// return f(); |
|||
// } |
|||
// |
|||
// int fortytwo() |
|||
// { |
|||
// return 42; |
|||
// } |
|||
import "C" |
|||
import "fmt" |
|||
|
|||
func main() { |
|||
f := C.intFunc(C.fortytwo) |
|||
fmt.Println(int(C.bridge_int_func(f))) |
|||
// Output: 42 |
|||
} |
|||
</pre> |
|||
<p> |
|||
In C, a function argument written as a fixed size array |
|||
actually requires a pointer to the first element of the array. |
|||
C compilers are aware of this calling convention and adjust |
|||
the call accordingly, but Go cannot. In Go, you must pass |
|||
the pointer to the first element explicitly: C.f(&C.x[0]). |
|||
</p> |
|||
<p> |
|||
A few special functions convert between Go and C types |
|||
by making copies of the data. In pseudo-Go definitions: |
|||
</p> |
|||
<pre>// Go string to C string |
|||
// The C string is allocated in the C heap using malloc. |
|||
// It is the caller's responsibility to arrange for it to be |
|||
// freed, such as by calling C.free (be sure to include stdlib.h |
|||
// if C.free is needed). |
|||
func C.CString(string) *C.char |
|||
|
|||
// C string to Go string |
|||
func C.GoString(*C.char) string |
|||
|
|||
// C data with explicit length to Go string |
|||
func C.GoStringN(*C.char, C.int) string |
|||
|
|||
// C data with explicit length to Go []byte |
|||
func C.GoBytes(unsafe.Pointer, C.int) []byte |
|||
</pre> |
|||
<h3 id="hdr-C_references_to_Go">C references to Go</h3> |
|||
<p> |
|||
Go functions can be exported for use by C code in the following way: |
|||
</p> |
|||
<pre>//export MyFunction |
|||
func MyFunction(arg1, arg2 int, arg3 string) int64 {...} |
|||
|
|||
//export MyFunction2 |
|||
func MyFunction2(arg1, arg2 int, arg3 string) (int64, *C.char) {...} |
|||
</pre> |
|||
<p> |
|||
They will be available in the C code as: |
|||
</p> |
|||
<pre>extern int64 MyFunction(int arg1, int arg2, GoString arg3); |
|||
extern struct MyFunction2_return MyFunction2(int arg1, int arg2, GoString arg3); |
|||
</pre> |
|||
<p> |
|||
found in the _cgo_export.h generated header, after any preambles |
|||
copied from the cgo input files. Functions with multiple |
|||
return values are mapped to functions returning a struct. |
|||
Not all Go types can be mapped to C types in a useful way. |
|||
</p> |
|||
<p> |
|||
Using //export in a file places a restriction on the preamble: |
|||
since it is copied into two different C output files, it must not |
|||
contain any definitions, only declarations. If a file contains both |
|||
definitions and declarations, then the two output files will produce |
|||
duplicate symbols and the linker will fail. To avoid this, definitions |
|||
must be placed in preambles in other files, or in C source files. |
|||
</p> |
|||
<h3 id="hdr-Passing_pointers">Passing pointers</h3> |
|||
<p> |
|||
Go is a garbage collected language, and the garbage collector needs to |
|||
know the location of every pointer to Go memory. Because of this, |
|||
there are restrictions on passing pointers between Go and C. |
|||
</p> |
|||
<p> |
|||
In this section the term Go pointer means a pointer to memory |
|||
allocated by Go (such as by using the & operator or calling the |
|||
predefined new function) and the term C pointer means a pointer to |
|||
memory allocated by C (such as by a call to C.malloc). Whether a |
|||
pointer is a Go pointer or a C pointer is a dynamic property |
|||
determined by how the memory was allocated; it has nothing to do with |
|||
the type of the pointer. |
|||
</p> |
|||
<p> |
|||
Go code may pass a Go pointer to C provided the Go memory to which it |
|||
points does not contain any Go pointers. The C code must preserve |
|||
this property: it must not store any Go pointers in Go memory, even |
|||
temporarily. When passing a pointer to a field in a struct, the Go |
|||
memory in question is the memory occupied by the field, not the entire |
|||
struct. When passing a pointer to an element in an array or slice, |
|||
the Go memory in question is the entire array or the entire backing |
|||
array of the slice. |
|||
</p> |
|||
<p> |
|||
C code may not keep a copy of a Go pointer after the call returns. |
|||
</p> |
|||
<p> |
|||
A Go function called by C code may not return a Go pointer. A Go |
|||
function called by C code may take C pointers as arguments, and it may |
|||
store non-pointer or C pointer data through those pointers, but it may |
|||
not store a Go pointer in memory pointed to by a C pointer. A Go |
|||
function called by C code may take a Go pointer as an argument, but it |
|||
must preserve the property that the Go memory to which it points does |
|||
not contain any Go pointers. |
|||
</p> |
|||
<p> |
|||
Go code may not store a Go pointer in C memory. C code may store Go |
|||
pointers in C memory, subject to the rule above: it must stop storing |
|||
the Go pointer when the C function returns. |
|||
</p> |
|||
<p> |
|||
These rules are checked dynamically at runtime. The checking is |
|||
controlled by the cgocheck setting of the GODEBUG environment |
|||
variable. The default setting is GODEBUG=cgocheck=1, which implements |
|||
reasonably cheap dynamic checks. These checks may be disabled |
|||
entirely using GODEBUG=cgocheck=0. Complete checking of pointer |
|||
handling, at some cost in run time, is available via GODEBUG=cgocheck=2. |
|||
</p> |
|||
<p> |
|||
It is possible to defeat this enforcement by using the unsafe package, |
|||
and of course there is nothing stopping the C code from doing anything |
|||
it likes. However, programs that break these rules are likely to fail |
|||
in unexpected and unpredictable ways. |
|||
</p> |
|||
<h3 id="hdr-Using_cgo_directly">Using cgo directly</h3> |
|||
<p> |
|||
Usage: |
|||
</p> |
|||
<pre>go tool cgo [cgo options] [-- compiler options] gofiles... |
|||
</pre> |
|||
<p> |
|||
Cgo transforms the specified input Go source files into several output |
|||
Go and C source files. |
|||
</p> |
|||
<p> |
|||
The compiler options are passed through uninterpreted when |
|||
invoking the C compiler to compile the C parts of the package. |
|||
</p> |
|||
<p> |
|||
The following options are available when running cgo directly: |
|||
</p> |
|||
<pre>-dynimport file |
|||
Write list of symbols imported by file. Write to |
|||
-dynout argument or to standard output. Used by go |
|||
build when building a cgo package. |
|||
-dynout file |
|||
Write -dynimport output to file. |
|||
-dynpackage package |
|||
Set Go package for -dynimport output. |
|||
-dynlinker |
|||
Write dynamic linker as part of -dynimport output. |
|||
-godefs |
|||
Write out input file in Go syntax replacing C package |
|||
names with real values. Used to generate files in the |
|||
syscall package when bootstrapping a new target. |
|||
-objdir directory |
|||
Put all generated files in directory. |
|||
-importpath string |
|||
The import path for the Go package. Optional; used for |
|||
nicer comments in the generated files. |
|||
-exportheader file |
|||
If there are any exported functions, write the |
|||
generated export declarations to file. |
|||
C code can #include this to see the declarations. |
|||
-gccgo |
|||
Generate output for the gccgo compiler rather than the |
|||
gc compiler. |
|||
-gccgoprefix prefix |
|||
The -fgo-prefix option to be used with gccgo. |
|||
-gccgopkgpath path |
|||
The -fgo-pkgpath option to be used with gccgo. |
|||
-import_runtime_cgo |
|||
If set (which it is by default) import runtime/cgo in |
|||
generated output. |
|||
-import_syscall |
|||
If set (which it is by default) import syscall in |
|||
generated output. |
|||
-debug-define |
|||
Debugging option. Print #defines. |
|||
-debug-gcc |
|||
Debugging option. Trace C compiler execution and output. |
|||
</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1276
pkg/bufio/index.html
File diff suppressed because it is too large
View File
1239
pkg/builtin/index.html
File diff suppressed because it is too large
View File
1733
pkg/bytes/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,277 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>aes - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package aes</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/aes"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package aes implements AES encryption (formerly Rijndael), as defined in |
|||
U.S. Federal Information Processing Standards Publication 197. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#NewCipher">func NewCipher(key []byte) (cipher.Block, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#KeySizeError">type KeySizeError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#KeySizeError.Error">func (k KeySizeError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/aes/aes_gcm.go">aes_gcm.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/aes/block.go">block.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/aes/cipher.go">cipher.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/aes/cipher_asm.go">cipher_asm.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/aes/const.go">const.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="BlockSize">BlockSize</span> = 16</pre> |
|||
<p> |
|||
The AES block size in bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NewCipher">func <a href="http://localhost:6060/src/crypto/aes/cipher.go?s=688:736#L21">NewCipher</a></h2> |
|||
<pre>func NewCipher(key []<a href="../../builtin/index.html#byte">byte</a>) (<a href="../cipher/index.html">cipher</a>.<a href="../cipher/index.html#Block">Block</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
NewCipher creates and returns a new cipher.Block. |
|||
The key argument should be the AES key, |
|||
either 16, 24, or 32 bytes to select |
|||
AES-128, AES-192, or AES-256. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="KeySizeError">type <a href="http://localhost:6060/src/crypto/aes/cipher.go?s=391:412#L11">KeySizeError</a></h2> |
|||
<pre>type KeySizeError <a href="../../builtin/index.html#int">int</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="KeySizeError.Error">func (KeySizeError) <a href="http://localhost:6060/src/crypto/aes/cipher.go?s=414:450#L13">Error</a></h3> |
|||
<pre>func (k <a href="index.html#KeySizeError">KeySizeError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1017
pkg/crypto/cipher/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,328 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>des - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package des</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/des"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package des implements the Data Encryption Standard (DES) and the |
|||
Triple Data Encryption Algorithm (TDEA) as defined |
|||
in U.S. Federal Information Processing Standards Publication 46-3. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#NewCipher">func NewCipher(key []byte) (cipher.Block, error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#NewTripleDESCipher">func NewTripleDESCipher(key []byte) (cipher.Block, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#KeySizeError">type KeySizeError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#KeySizeError.Error">func (k KeySizeError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_NewTripleDESCipher">NewTripleDESCipher</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/des/block.go">block.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/des/cipher.go">cipher.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/des/const.go">const.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="BlockSize">BlockSize</span> = 8</pre> |
|||
<p> |
|||
The DES block size in bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NewCipher">func <a href="http://localhost:6060/src/crypto/des/cipher.go?s=541:589#L17">NewCipher</a></h2> |
|||
<pre>func NewCipher(key []<a href="../../builtin/index.html#byte">byte</a>) (<a href="../cipher/index.html">cipher</a>.<a href="../cipher/index.html#Block">Block</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
NewCipher creates and returns a new cipher.Block. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NewTripleDESCipher">func <a href="http://localhost:6060/src/crypto/des/cipher.go?s=1141:1198#L39">NewTripleDESCipher</a></h2> |
|||
<pre>func NewTripleDESCipher(key []<a href="../../builtin/index.html#byte">byte</a>) (<a href="../cipher/index.html">cipher</a>.<a href="../cipher/index.html#Block">Block</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
NewTripleDESCipher creates and returns a new cipher.Block. |
|||
</p> |
|||
|
|||
<div id="example_NewTripleDESCipher" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code"> |
|||
<span class="comment">// NewTripleDESCipher can also be used when EDE2 is required by</span> |
|||
<span class="comment">// duplicating the first 8 bytes of the 16-byte key.</span> |
|||
ede2Key := []byte("example key 1234") |
|||
|
|||
var tripleDESKey []byte |
|||
tripleDESKey = append(tripleDESKey, ede2Key[:16]...) |
|||
tripleDESKey = append(tripleDESKey, ede2Key[:8]...) |
|||
|
|||
_, err := des.NewTripleDESCipher(tripleDESKey) |
|||
if err != nil { |
|||
panic(err) |
|||
} |
|||
|
|||
<span class="comment">// See crypto/cipher for how to use a cipher.Block for encryption and</span> |
|||
<span class="comment">// decryption.</span> |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="KeySizeError">type <a href="http://localhost:6060/src/crypto/des/cipher.go?s=266:287#L5">KeySizeError</a></h2> |
|||
<pre>type KeySizeError <a href="../../builtin/index.html#int">int</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="KeySizeError.Error">func (KeySizeError) <a href="http://localhost:6060/src/crypto/des/cipher.go?s=289:325#L7">Error</a></h3> |
|||
<pre>func (k <a href="index.html#KeySizeError">KeySizeError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,417 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>dsa - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package dsa</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/dsa"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#GenerateKey">func GenerateKey(priv *PrivateKey, rand io.Reader) error</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#GenerateParameters">func GenerateParameters(params *Parameters, rand io.Reader, sizes ParameterSizes) (err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sign">func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Verify">func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ParameterSizes">type ParameterSizes</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Parameters">type Parameters</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PrivateKey">type PrivateKey</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PublicKey">type PublicKey</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/dsa/dsa.go">dsa.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="ErrInvalidPublicKey">ErrInvalidPublicKey</span> = <a href="../../errors/index.html">errors</a>.<a href="../../errors/index.html#New">New</a>("crypto/dsa: invalid public key")</pre> |
|||
<p> |
|||
ErrInvalidPublicKey results when a public key is not usable by this code. |
|||
FIPS is quite strict about the format of DSA keys, but other code may be |
|||
less so. Thus, when using keys which may have been generated by other code, |
|||
this error must be handled. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="GenerateKey">func <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=3306:3362#L141">GenerateKey</a></h2> |
|||
<pre>func GenerateKey(priv *<a href="index.html#PrivateKey">PrivateKey</a>, rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>) <a href="../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
GenerateKey generates a public&private key pair. The Parameters of the |
|||
PrivateKey must already be valid (see GenerateParameters). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="GenerateParameters">func <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=1576:1669#L45">GenerateParameters</a></h2> |
|||
<pre>func GenerateParameters(params *<a href="index.html#Parameters">Parameters</a>, rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, sizes <a href="index.html#ParameterSizes">ParameterSizes</a>) (err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
GenerateParameters puts a random, valid set of DSA parameters into params. |
|||
This function can take many seconds, even on fast machines. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sign">func <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=4644:4727#L184">Sign</a></h2> |
|||
<pre>func Sign(rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, priv *<a href="index.html#PrivateKey">PrivateKey</a>, hash []<a href="../../builtin/index.html#byte">byte</a>) (r, s *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Sign signs an arbitrary length hash (which should be the result of hashing a |
|||
larger message) using the private key, priv. It returns the signature as a |
|||
pair of integers. The security of the private key depends on the entropy of |
|||
rand. |
|||
</p> |
|||
<p> |
|||
Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated |
|||
to the byte-length of the subgroup. This function does not perform that |
|||
truncation itself. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Verify">func <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=5673:5733#L239">Verify</a></h2> |
|||
<pre>func Verify(pub *<a href="index.html#PublicKey">PublicKey</a>, hash []<a href="../../builtin/index.html#byte">byte</a>, r, s *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Verify verifies the signature in r, s of hash using the public key, pub. It |
|||
reports whether the signature is valid. |
|||
</p> |
|||
<p> |
|||
Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated |
|||
to the byte-length of the subgroup. This function does not perform that |
|||
truncation itself. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ParameterSizes">type <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=1161:1184#L30">ParameterSizes</a></h2> |
|||
<pre>type ParameterSizes <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ParameterSizes is a enumeration of the acceptable bit lengths of the primes |
|||
in a set of DSA parameters. See FIPS 186-3, section 4.2. |
|||
</p> |
|||
|
|||
|
|||
|
|||
<pre>const ( |
|||
<span id="L1024N160">L1024N160</span> <a href="index.html#ParameterSizes">ParameterSizes</a> = <a href="../../builtin/index.html#iota">iota</a> |
|||
<span id="L2048N224">L2048N224</span> |
|||
<span id="L2048N256">L2048N256</span> |
|||
<span id="L3072N256">L3072N256</span> |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Parameters">type <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=453:497#L6">Parameters</a></h2> |
|||
<pre>type Parameters struct { |
|||
P, Q, G *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> |
|||
}</pre> |
|||
<p> |
|||
Parameters represents the domain parameters for a key. These parameters can |
|||
be shared across many keys. The bit length of Q must be a multiple of 8. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PrivateKey">type <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=636:685#L17">PrivateKey</a></h2> |
|||
<pre>type PrivateKey struct { |
|||
<a href="index.html#PublicKey">PublicKey</a> |
|||
X *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> |
|||
}</pre> |
|||
<p> |
|||
PrivateKey represents a DSA private key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PublicKey">type <a href="http://localhost:6060/src/crypto/dsa/dsa.go?s=541:590#L11">PublicKey</a></h2> |
|||
<pre>type PublicKey struct { |
|||
<a href="index.html#Parameters">Parameters</a> |
|||
Y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> |
|||
}</pre> |
|||
<p> |
|||
PublicKey represents a DSA public key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,347 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>ecdsa - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package ecdsa</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/ecdsa"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as |
|||
defined in FIPS 186-3. |
|||
</p> |
|||
<p> |
|||
This implementation derives the nonce from an AES-CTR CSPRNG keyed by |
|||
ChopMD(256, SHA2-512(priv.D || entropy || hash)). The CSPRNG key is IRO by |
|||
a result of Coron; the AES-CTR stream is IRO under standard assumptions. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Sign">func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Verify">func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PrivateKey">type PrivateKey</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#GenerateKey">func GenerateKey(c elliptic.Curve, rand io.Reader) (priv *PrivateKey, err error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#PrivateKey.Public">func (priv *PrivateKey) Public() crypto.PublicKey</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#PrivateKey.Sign">func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PublicKey">type PublicKey</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go">ecdsa.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sign">func <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=4284:4367#L137">Sign</a></h2> |
|||
<pre>func Sign(rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, priv *<a href="index.html#PrivateKey">PrivateKey</a>, hash []<a href="../../builtin/index.html#byte">byte</a>) (r, s *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Sign signs an arbitrary length hash (which should be the result of hashing a |
|||
larger message) using the private key, priv. It returns the signature as a |
|||
pair of integers. The security of the private key depends on the entropy of |
|||
rand. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Verify">func <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=5960:6020#L211">Verify</a></h2> |
|||
<pre>func Verify(pub *<a href="index.html#PublicKey">PublicKey</a>, hash []<a href="../../builtin/index.html#byte">byte</a>, r, s *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Verify verifies the signature in r, s of hash using the public key, pub. Its |
|||
return value records whether the signature is valid. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PrivateKey">type <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=1378:1427#L42">PrivateKey</a></h2> |
|||
<pre>type PrivateKey struct { |
|||
<a href="index.html#PublicKey">PublicKey</a> |
|||
D *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> |
|||
}</pre> |
|||
<p> |
|||
PrivateKey represents a ECDSA private key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="GenerateKey">func <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=2606:2686#L89">GenerateKey</a></h3> |
|||
<pre>func GenerateKey(c <a href="../elliptic/index.html">elliptic</a>.<a href="../elliptic/index.html#Curve">Curve</a>, rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>) (priv *<a href="index.html#PrivateKey">PrivateKey</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
GenerateKey generates a public and private key pair. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="PrivateKey.Public">func (*PrivateKey) <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=1532:1581#L52">Public</a></h3> |
|||
<pre>func (priv *<a href="index.html#PrivateKey">PrivateKey</a>) Public() <a href="../index.html">crypto</a>.<a href="../index.html#PublicKey">PublicKey</a></pre> |
|||
<p> |
|||
Public returns the public key corresponding to priv. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="PrivateKey.Sign">func (*PrivateKey) <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=1853:1949#L60">Sign</a></h3> |
|||
<pre>func (priv *<a href="index.html#PrivateKey">PrivateKey</a>) Sign(rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, msg []<a href="../../builtin/index.html#byte">byte</a>, opts <a href="../index.html">crypto</a>.<a href="../index.html#SignerOpts">SignerOpts</a>) ([]<a href="../../builtin/index.html#byte">byte</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Sign signs msg with priv, reading randomness from rand. This method is |
|||
intended to support keys where the private part is kept in, for example, a |
|||
hardware module. Common uses should use the Sign function in this package |
|||
directly. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PublicKey">type <a href="http://localhost:6060/src/crypto/ecdsa/ecdsa.go?s=1274:1330#L36">PublicKey</a></h2> |
|||
<pre>type PublicKey struct { |
|||
<a href="../elliptic/index.html">elliptic</a>.<a href="../elliptic/index.html#Curve">Curve</a> |
|||
X, Y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> |
|||
}</pre> |
|||
<p> |
|||
PublicKey represents an ECDSA public key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,450 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>elliptic - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package elliptic</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/elliptic"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package elliptic implements several standard elliptic curves over prime |
|||
fields. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#GenerateKey">func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Marshal">func Marshal(curve Curve, x, y *big.Int) []byte</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Unmarshal">func Unmarshal(curve Curve, data []byte) (x, y *big.Int)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Curve">type Curve</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#P224">func P224() Curve</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#P256">func P256() Curve</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#P384">func P384() Curve</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#P521">func P521() Curve</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#CurveParams">type CurveParams</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.Add">func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.Double">func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.IsOnCurve">func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.Params">func (curve *CurveParams) Params() *CurveParams</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.ScalarBaseMult">func (curve *CurveParams) ScalarBaseMult(k []byte) (*big.Int, *big.Int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#CurveParams.ScalarMult">func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/elliptic/elliptic.go">elliptic.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/elliptic/p224.go">p224.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/elliptic/p256_amd64.go">p256_amd64.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="GenerateKey">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=7368:7453#L266">GenerateKey</a></h2> |
|||
<pre>func GenerateKey(curve <a href="index.html#Curve">Curve</a>, rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>) (priv []<a href="../../builtin/index.html#byte">byte</a>, x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
GenerateKey returns a public/private key pair. The private key is |
|||
generated using the given reader, which must return random data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Marshal">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=8216:8263#L295">Marshal</a></h2> |
|||
<pre>func Marshal(curve <a href="index.html#Curve">Curve</a>, x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) []<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Marshal converts a point into the form specified in section 4.3.6 of ANSI X9.62. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Unmarshal">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=8671:8727#L310">Unmarshal</a></h2> |
|||
<pre>func Unmarshal(curve <a href="index.html#Curve">Curve</a>, data []<a href="../../builtin/index.html#byte">byte</a>) (x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>)</pre> |
|||
<p> |
|||
Unmarshal converts a point, serialized by Marshal, into an x, y pair. |
|||
It is an error if the point is not on the curve. On error, x = nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Curve">type <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=871:1509#L14">Curve</a></h2> |
|||
<pre>type Curve interface { |
|||
<span class="comment">// Params returns the parameters for the curve.</span> |
|||
Params() *<a href="index.html#CurveParams">CurveParams</a> |
|||
<span class="comment">// IsOnCurve reports whether the given (x,y) lies on the curve.</span> |
|||
IsOnCurve(x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) <a href="../../builtin/index.html#bool">bool</a> |
|||
<span class="comment">// Add returns the sum of (x1,y1) and (x2,y2)</span> |
|||
Add(x1, y1, x2, y2 *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) (x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) |
|||
<span class="comment">// Double returns 2*(x,y)</span> |
|||
Double(x1, y1 *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) (x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) |
|||
<span class="comment">// ScalarMult returns k*(Bx,By) where k is a number in big-endian form.</span> |
|||
ScalarMult(x1, y1 *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, k []<a href="../../builtin/index.html#byte">byte</a>) (x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) |
|||
<span class="comment">// ScalarBaseMult returns k*G, where G is the base point of the group</span> |
|||
<span class="comment">// and k is an integer in big-endian form.</span> |
|||
ScalarBaseMult(k []<a href="../../builtin/index.html#byte">byte</a>) (x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) |
|||
}</pre> |
|||
<p> |
|||
A Curve represents a short-form Weierstrass curve with a=-3. |
|||
See <a href="http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html">http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html</a> |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="P224">func <a href="http://localhost:6060/src/crypto/elliptic/p224.go?s=1291:1308#L29">P224</a></h3> |
|||
<pre>func P224() <a href="index.html#Curve">Curve</a></pre> |
|||
<p> |
|||
P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2) |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="P256">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=11132:11149#L360">P256</a></h3> |
|||
<pre>func P256() <a href="index.html#Curve">Curve</a></pre> |
|||
<p> |
|||
P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3) |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="P384">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=11269:11286#L366">P384</a></h3> |
|||
<pre>func P384() <a href="index.html#Curve">Curve</a></pre> |
|||
<p> |
|||
P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4) |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="P521">func <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=11406:11423#L372">P521</a></h3> |
|||
<pre>func P521() <a href="index.html#Curve">Curve</a></pre> |
|||
<p> |
|||
P521 returns a Curve which implements P-521 (see FIPS 186-3, section D.2.5) |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="CurveParams">type <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=1646:1985#L32">CurveParams</a></h2> |
|||
<pre>type CurveParams struct { |
|||
P *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> <span class="comment">// the order of the underlying field</span> |
|||
N *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> <span class="comment">// the order of the base point</span> |
|||
B *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> <span class="comment">// the constant of the curve equation</span> |
|||
Gx, Gy *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a> <span class="comment">// (x,y) of the base point</span> |
|||
BitSize <a href="../../builtin/index.html#int">int</a> <span class="comment">// the size of the underlying field</span> |
|||
Name <a href="../../builtin/index.html#string">string</a> <span class="comment">// the canonical name of the curve</span> |
|||
}</pre> |
|||
<p> |
|||
CurveParams contains the parameters of an elliptic curve and also provides |
|||
a generic, non-constant time implementation of Curve. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.Add">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=3249:3324#L92">Add</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) Add(x1, y1, x2, y2 *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) (*<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.Double">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=5095:5165#L176">Double</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) Double(x1, y1 *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) (*<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.IsOnCurve">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=2054:2109#L45">IsOnCurve</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) IsOnCurve(x, y *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.Params">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=1987:2034#L41">Params</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) Params() *<a href="index.html#CurveParams">CurveParams</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.ScalarBaseMult">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=7043:7114#L258">ScalarBaseMult</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) ScalarBaseMult(k []<a href="../../builtin/index.html#byte">byte</a>) (*<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CurveParams.ScalarMult">func (*CurveParams) <a href="http://localhost:6060/src/crypto/elliptic/elliptic.go?s=6608:6692#L241">ScalarMult</a></h3> |
|||
<pre>func (curve *<a href="index.html#CurveParams">CurveParams</a>) ScalarMult(Bx, By *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, k []<a href="../../builtin/index.html#byte">byte</a>) (*<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,250 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>hmac - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package hmac</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/hmac"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as |
|||
defined in U.S. Federal Information Processing Standards Publication 198. |
|||
An HMAC is a cryptographic hash that uses a key to sign a message. |
|||
The receiver verifies the hash by recomputing it using the same key. |
|||
</p> |
|||
<p> |
|||
Receivers should be careful to use Equal to compare MACs in order to avoid |
|||
timing side-channels: |
|||
</p> |
|||
<pre>// CheckMAC reports whether messageMAC is a valid HMAC tag for message. |
|||
func CheckMAC(message, messageMAC, key []byte) bool { |
|||
mac := hmac.New(sha256.New, key) |
|||
mac.Write(message) |
|||
expectedMAC := mac.Sum(nil) |
|||
return hmac.Equal(messageMAC, expectedMAC) |
|||
} |
|||
</pre> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Equal">func Equal(mac1, mac2 []byte) bool</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#New">func New(h func() hash.Hash, key []byte) hash.Hash</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/hmac/hmac.go">hmac.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Equal">func <a href="http://localhost:6060/src/crypto/hmac/hmac.go?s=2448:2482#L87">Equal</a></h2> |
|||
<pre>func Equal(mac1, mac2 []<a href="../../builtin/index.html#byte">byte</a>) <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Equal compares two MACs for equality without leaking timing information. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/crypto/hmac/hmac.go?s=1969:2019#L68">New</a></h2> |
|||
<pre>func New(h func() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a>, key []<a href="../../builtin/index.html#byte">byte</a>) <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new HMAC hash using the given hash.Hash type and key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,744 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>crypto - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package crypto</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package crypto collects common cryptographic constants. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RegisterHash">func RegisterHash(h Hash, f func() hash.Hash)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Decrypter">type Decrypter</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#DecrypterOpts">type DecrypterOpts</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Hash">type Hash</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Hash.Available">func (h Hash) Available() bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hash.HashFunc">func (h Hash) HashFunc() Hash</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hash.New">func (h Hash) New() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hash.Size">func (h Hash) Size() int</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PrivateKey">type PrivateKey</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#PublicKey">type PublicKey</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Signer">type Signer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#SignerOpts">type SignerOpts</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/crypto.go">crypto.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RegisterHash">func <a href="http://localhost:6060/src/crypto/crypto.go?s=2728:2773#L82">RegisterHash</a></h2> |
|||
<pre>func RegisterHash(h <a href="index.html#Hash">Hash</a>, f func() <a href="../hash/index.html">hash</a>.<a href="../hash/index.html#Hash">Hash</a>)</pre> |
|||
<p> |
|||
RegisterHash registers a function that returns a new instance of the given |
|||
hash function. This is intended to be called from the init function in |
|||
packages that implement hash functions. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Decrypter">type <a href="http://localhost:6060/src/crypto/crypto.go?s=4661:5033#L129">Decrypter</a></h2> |
|||
<pre>type Decrypter interface { |
|||
<span class="comment">// Public returns the public key corresponding to the opaque,</span> |
|||
<span class="comment">// private key.</span> |
|||
Public() <a href="index.html#PublicKey">PublicKey</a> |
|||
|
|||
<span class="comment">// Decrypt decrypts msg. The opts argument should be appropriate for</span> |
|||
<span class="comment">// the primitive used. See the documentation in each implementation for</span> |
|||
<span class="comment">// details.</span> |
|||
Decrypt(rand <a href="../io/index.html">io</a>.<a href="../io/index.html#Reader">Reader</a>, msg []<a href="../builtin/index.html#byte">byte</a>, opts <a href="index.html#DecrypterOpts">DecrypterOpts</a>) (plaintext []<a href="../builtin/index.html#byte">byte</a>, err <a href="../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Decrypter is an interface for an opaque private key that can be used for |
|||
asymmetric decryption operations. An example would be an RSA key |
|||
kept in a hardware module. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="DecrypterOpts">type <a href="http://localhost:6060/src/crypto/crypto.go?s=5035:5065#L140">DecrypterOpts</a></h2> |
|||
<pre>type DecrypterOpts interface{}</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Hash">type <a href="http://localhost:6060/src/crypto/crypto.go?s=364:378#L6">Hash</a></h2> |
|||
<pre>type Hash <a href="../builtin/index.html#uint">uint</a></pre> |
|||
<p> |
|||
Hash identifies a cryptographic hash function that is implemented in another |
|||
package. |
|||
</p> |
|||
|
|||
|
|||
|
|||
<pre>const ( |
|||
<span id="MD4">MD4</span> <a href="index.html#Hash">Hash</a> = 1 + <a href="../builtin/index.html#iota">iota</a> <span class="comment">// import golang.org/x/crypto/md4</span> |
|||
<span id="MD5">MD5</span> <span class="comment">// import crypto/md5</span> |
|||
<span id="SHA1">SHA1</span> <span class="comment">// import crypto/sha1</span> |
|||
<span id="SHA224">SHA224</span> <span class="comment">// import crypto/sha256</span> |
|||
<span id="SHA256">SHA256</span> <span class="comment">// import crypto/sha256</span> |
|||
<span id="SHA384">SHA384</span> <span class="comment">// import crypto/sha512</span> |
|||
<span id="SHA512">SHA512</span> <span class="comment">// import crypto/sha512</span> |
|||
<span id="MD5SHA1">MD5SHA1</span> <span class="comment">// no implementation; MD5+SHA1 used for TLS RSA</span> |
|||
<span id="RIPEMD160">RIPEMD160</span> <span class="comment">// import golang.org/x/crypto/ripemd160</span> |
|||
<span id="SHA3_224">SHA3_224</span> <span class="comment">// import golang.org/x/crypto/sha3</span> |
|||
<span id="SHA3_256">SHA3_256</span> <span class="comment">// import golang.org/x/crypto/sha3</span> |
|||
<span id="SHA3_384">SHA3_384</span> <span class="comment">// import golang.org/x/crypto/sha3</span> |
|||
<span id="SHA3_512">SHA3_512</span> <span class="comment">// import golang.org/x/crypto/sha3</span> |
|||
<span id="SHA512_224">SHA512_224</span> <span class="comment">// import crypto/sha512</span> |
|||
<span id="SHA512_256">SHA512_256</span> <span class="comment">// import crypto/sha512</span> |
|||
|
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hash.Available">func (Hash) <a href="http://localhost:6060/src/crypto/crypto.go?s=2457:2487#L75">Available</a></h3> |
|||
<pre>func (h <a href="index.html#Hash">Hash</a>) Available() <a href="../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Available reports whether the given hash function is linked into the binary. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hash.HashFunc">func (Hash) <a href="http://localhost:6060/src/crypto/crypto.go?s=458:487#L9">HashFunc</a></h3> |
|||
<pre>func (h <a href="index.html#Hash">Hash</a>) HashFunc() <a href="index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
HashFunc simply returns the value of h so that Hash implements SignerOpts. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hash.New">func (Hash) <a href="http://localhost:6060/src/crypto/crypto.go?s=2174:2203#L64">New</a></h3> |
|||
<pre>func (h <a href="index.html#Hash">Hash</a>) New() <a href="../hash/index.html">hash</a>.<a href="../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new hash.Hash calculating the given hash function. New panics |
|||
if the hash function is not linked into the binary. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hash.Size">func (Hash) <a href="http://localhost:6060/src/crypto/crypto.go?s=1855:1879#L53">Size</a></h3> |
|||
<pre>func (h <a href="index.html#Hash">Hash</a>) Size() <a href="../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
Size returns the length, in bytes, of a digest resulting from the given hash |
|||
function. It doesn't require that the hash function in question be linked |
|||
into the program. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PrivateKey">type <a href="http://localhost:6060/src/crypto/crypto.go?s=3041:3068#L93">PrivateKey</a></h2> |
|||
<pre>type PrivateKey interface{}</pre> |
|||
<p> |
|||
PrivateKey represents a private key using an unspecified algorithm. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PublicKey">type <a href="http://localhost:6060/src/crypto/crypto.go?s=2942:2968#L90">PublicKey</a></h2> |
|||
<pre>type PublicKey interface{}</pre> |
|||
<p> |
|||
PublicKey represents a public key using an unspecified algorithm. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Signer">type <a href="http://localhost:6060/src/crypto/crypto.go?s=3217:4212#L97">Signer</a></h2> |
|||
<pre>type Signer interface { |
|||
<span class="comment">// Public returns the public key corresponding to the opaque,</span> |
|||
<span class="comment">// private key.</span> |
|||
Public() <a href="index.html#PublicKey">PublicKey</a> |
|||
|
|||
<span class="comment">// Sign signs digest with the private key, possibly using entropy from</span> |
|||
<span class="comment">// rand. For an RSA key, the resulting signature should be either a</span> |
|||
<span class="comment">// PKCS#1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA</span> |
|||
<span class="comment">// key, it should be a DER-serialised, ASN.1 signature structure.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Hash implements the SignerOpts interface and, in most cases, one can</span> |
|||
<span class="comment">// simply pass in the hash function used as opts. Sign may also attempt</span> |
|||
<span class="comment">// to type assert opts to other types in order to obtain algorithm</span> |
|||
<span class="comment">// specific values. See the documentation in each package for details.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Note that when a signature of a hash of a larger message is needed,</span> |
|||
<span class="comment">// the caller is responsible for hashing the larger message and passing</span> |
|||
<span class="comment">// the hash (as digest) and the hash function (as opts) to Sign.</span> |
|||
Sign(rand <a href="../io/index.html">io</a>.<a href="../io/index.html#Reader">Reader</a>, digest []<a href="../builtin/index.html#byte">byte</a>, opts <a href="index.html#SignerOpts">SignerOpts</a>) (signature []<a href="../builtin/index.html#byte">byte</a>, err <a href="../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Signer is an interface for an opaque private key that can be used for |
|||
signing operations. For example, an RSA key kept in a hardware module. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="SignerOpts">type <a href="http://localhost:6060/src/crypto/crypto.go?s=4272:4485#L119">SignerOpts</a></h2> |
|||
<pre>type SignerOpts interface { |
|||
<span class="comment">// HashFunc returns an identifier for the hash function used to produce</span> |
|||
<span class="comment">// the message passed to Signer.Sign, or else zero to indicate that no</span> |
|||
<span class="comment">// hashing was done.</span> |
|||
HashFunc() <a href="index.html#Hash">Hash</a> |
|||
}</pre> |
|||
<p> |
|||
SignerOpts contains options for signing with a Signer. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-subdirectories">Subdirectories</h2> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="http://localhost:6060/pkg/">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="aes/index.html">aes</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package aes implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="cipher/index.html">cipher</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package cipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="des/index.html">des</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package des implements the Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDEA) as defined in U.S. Federal Information Processing Standards Publication 46-3. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="dsa/index.html">dsa</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="ecdsa/index.html">ecdsa</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-3. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="elliptic/index.html">elliptic</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package elliptic implements several standard elliptic curves over prime fields. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="hmac/index.html">hmac</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="md5/index.html">md5</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package md5 implements the MD5 hash algorithm as defined in RFC 1321. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="rand/index.html">rand</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package rand implements a cryptographically secure pseudorandom number generator. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="rc4/index.html">rc4</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="rsa/index.html">rsa</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package rsa implements RSA encryption as specified in PKCS#1. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="sha1/index.html">sha1</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package sha1 implements the SHA1 hash algorithm as defined in RFC 3174. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="sha256/index.html">sha256</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="sha512/index.html">sha512</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="subtle/index.html">subtle</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="tls/index.html">tls</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package tls partially implements TLS 1.2, as specified in RFC 5246. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="x509/index.html">x509</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package x509 parses X.509-encoded keys and certificates. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="x509/pkix/index.html">pkix</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,313 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>md5 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package md5</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/md5"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package md5 implements the MD5 hash algorithm as defined in RFC 1321. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#New">func New() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum">func Sum(data []byte) [Size]byte</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_New">New</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_Sum">Sum</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/md5/md5.go">md5.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/md5/md5block.go">md5block.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/md5/md5block_decl.go">md5block_decl.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="BlockSize">BlockSize</span> = 64</pre> |
|||
<p> |
|||
The blocksize of MD5 in bytes. |
|||
</p> |
|||
|
|||
|
|||
<pre>const <span id="Size">Size</span> = 16</pre> |
|||
<p> |
|||
The size of an MD5 checksum in bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/crypto/md5/md5.go?s=913:933#L41">New</a></h2> |
|||
<pre>func New() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new hash.Hash computing the MD5 checksum. |
|||
</p> |
|||
|
|||
<div id="example_New" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">h := md5.New() |
|||
io.WriteString(h, "The fog is getting thicker!") |
|||
io.WriteString(h, "And Leon's getting laaarger!") |
|||
fmt.Printf("%x", h.Sum(nil)) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">e2c569be17396eca2a2e3c11578123ed |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum">func <a href="http://localhost:6060/src/crypto/md5/md5.go?s=2244:2276#L115">Sum</a></h2> |
|||
<pre>func Sum(data []<a href="../../builtin/index.html#byte">byte</a>) [<a href="index.html#Size">Size</a>]<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Sum returns the MD5 checksum of the data. |
|||
</p> |
|||
|
|||
<div id="example_Sum" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">data := []byte("These pretzels are making me thirsty.") |
|||
fmt.Printf("%x", md5.Sum(data)) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">b0804ec967f48520697662a204f5fe72 |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,321 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>rand - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package rand</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/rand"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package rand implements a cryptographically secure |
|||
pseudorandom number generator. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Int">func Int(rand io.Reader, max *big.Int) (n *big.Int, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Prime">func Prime(rand io.Reader, bits int) (p *big.Int, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Read">func Read(b []byte) (n int, err error)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_Read">Read</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rand/eagain.go">eagain.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rand/rand.go">rand.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rand/rand_linux.go">rand_linux.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rand/rand_unix.go">rand_unix.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rand/util.go">util.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="Reader">Reader</span> <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a></pre> |
|||
<p> |
|||
Reader is a global, shared instance of a cryptographically |
|||
strong pseudo-random generator. |
|||
</p> |
|||
<p> |
|||
On Unix-like systems, Reader reads from /dev/urandom. |
|||
On Linux, Reader uses getrandom(2) if available, /dev/urandom otherwise. |
|||
On Windows systems, Reader uses the CryptGenRandom API. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Int">func <a href="http://localhost:6060/src/crypto/rand/util.go?s=3072:3134#L96">Int</a></h2> |
|||
<pre>func Int(rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, max *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>) (n *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Int returns a uniform random value in [0, max). It panics if max <= 0. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Prime">func <a href="http://localhost:6060/src/crypto/rand/util.go?s=1126:1186#L21">Prime</a></h2> |
|||
<pre>func Prime(rand <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Reader">Reader</a>, bits <a href="../../builtin/index.html#int">int</a>) (p *<a href="../../math/big/index.html">big</a>.<a href="../../math/big/index.html#Int">Int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Prime returns a number, p, of the given size, such that p is prime |
|||
with high probability. |
|||
Prime will return error for any error returned by rand.Read or if bits < 2. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Read">func <a href="http://localhost:6060/src/crypto/rand/rand.go?s=714:752#L11">Read</a></h2> |
|||
<pre>func Read(b []<a href="../../builtin/index.html#byte">byte</a>) (n <a href="../../builtin/index.html#int">int</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Read is a helper function that calls Reader.Read using io.ReadFull. |
|||
On return, n == len(b) if and only if err == nil. |
|||
</p> |
|||
|
|||
<div id="example_Read" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
<p>This example reads 10 cryptographically secure pseudorandom numbers from |
|||
rand.Reader and writes them to a byte slice. |
|||
</p> |
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">c := 10 |
|||
b := make([]byte, c) |
|||
_, err := rand.Read(b) |
|||
if err != nil { |
|||
fmt.Println("error:", err) |
|||
return |
|||
} |
|||
<span class="comment">// The slice should now contain random bytes instead of only zeroes.</span> |
|||
fmt.Println(bytes.Equal(b, make([]byte, c))) |
|||
|
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">false |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,329 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>rc4 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package rc4</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/rc4"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package rc4 implements RC4 encryption, as defined in Bruce Schneier's |
|||
Applied Cryptography. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Cipher">type Cipher</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewCipher">func NewCipher(key []byte) (*Cipher, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Cipher.Reset">func (c *Cipher) Reset()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Cipher.XORKeyStream">func (c *Cipher) XORKeyStream(dst, src []byte)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#KeySizeError">type KeySizeError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#KeySizeError.Error">func (k KeySizeError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#pkg-note-BUG">Bugs</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rc4/rc4.go">rc4.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/rc4/rc4_asm.go">rc4_asm.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Cipher">type <a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=457:509#L5">Cipher</a></h2> |
|||
<pre>type Cipher struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
A Cipher is an instance of RC4 using a particular key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewCipher">func <a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=769:812#L18">NewCipher</a></h3> |
|||
<pre>func NewCipher(key []<a href="../../builtin/index.html#byte">byte</a>) (*<a href="index.html#Cipher">Cipher</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
NewCipher creates and returns a new Cipher. The key argument should be the |
|||
RC4 key, at least 1 byte and at most 256 bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Cipher.Reset">func (*Cipher) <a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=1174:1198#L37">Reset</a></h3> |
|||
<pre>func (c *<a href="index.html#Cipher">Cipher</a>) Reset()</pre> |
|||
<p> |
|||
Reset zeros the key data so that it will no longer appear in the |
|||
process's memory. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Cipher.XORKeyStream">func (*Cipher) <a href="http://localhost:6060/src/crypto/rc4/rc4_asm.go?s=433:479#L3">XORKeyStream</a></h3> |
|||
<pre>func (c *<a href="index.html#Cipher">Cipher</a>) XORKeyStream(dst, src []<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
XORKeyStream sets dst to the result of XORing src with the key stream. |
|||
Dst and src may be the same slice but otherwise should not overlap. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="KeySizeError">type <a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=511:532#L10">KeySizeError</a></h2> |
|||
<pre>type KeySizeError <a href="../../builtin/index.html#int">int</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="KeySizeError.Error">func (KeySizeError) <a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=534:570#L12">Error</a></h3> |
|||
<pre>func (k <a href="index.html#KeySizeError">KeySizeError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-note-BUG">Bugs</h2> |
|||
<ul style="list-style: none; padding: 0;"> |
|||
|
|||
<li><a href="http://localhost:6060/src/crypto/rc4/rc4.go?s=271:379#L1">☞</a> RC4 is in common use but has design weaknesses that make |
|||
it a poor choice for new protocols. |
|||
</li> |
|||
|
|||
</ul> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1088
pkg/crypto/rsa/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,313 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>sha1 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package sha1</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/sha1"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package sha1 implements the SHA1 hash algorithm as defined in RFC 3174. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#New">func New() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum">func Sum(data []byte) [Size]byte</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_New">New</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_Sum">Sum</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha1/sha1.go">sha1.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha1/sha1block.go">sha1block.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha1/sha1block_decl.go">sha1block_decl.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="BlockSize">BlockSize</span> = 64</pre> |
|||
<p> |
|||
The blocksize of SHA1 in bytes. |
|||
</p> |
|||
|
|||
|
|||
<pre>const <span id="Size">Size</span> = 20</pre> |
|||
<p> |
|||
The size of a SHA1 checksum in bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/crypto/sha1/sha1.go?s=900:920#L41">New</a></h2> |
|||
<pre>func New() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new hash.Hash computing the SHA1 checksum. |
|||
</p> |
|||
|
|||
<div id="example_New" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">h := sha1.New() |
|||
io.WriteString(h, "His money is twice tainted:") |
|||
io.WriteString(h, " 'taint yours and 'taint mine.") |
|||
fmt.Printf("% x", h.Sum(nil)) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum">func <a href="http://localhost:6060/src/crypto/sha1/sha1.go?s=2235:2267#L115">Sum</a></h2> |
|||
<pre>func Sum(data []<a href="../../builtin/index.html#byte">byte</a>) [<a href="index.html#Size">Size</a>]<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Sum returns the SHA1 checksum of the data. |
|||
</p> |
|||
|
|||
<div id="example_Sum" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">data := []byte("This page intentionally left blank.") |
|||
fmt.Printf("% x", sha1.Sum(data)) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">af 06 49 23 bb f2 30 15 96 aa c4 c2 73 ba 32 17 8e bc 4a 96 |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,291 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>sha256 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package sha256</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/sha256"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined |
|||
in FIPS 180-4. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#New">func New() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#New224">func New224() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum224">func Sum224(data []byte) (sum224 [Size224]byte)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum256">func Sum256(data []byte) [Size]byte</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha256/sha256.go">sha256.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha256/sha256block_decl.go">sha256block_decl.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="BlockSize">BlockSize</span> = 64</pre> |
|||
<p> |
|||
The blocksize of SHA256 and SHA224 in bytes. |
|||
</p> |
|||
|
|||
|
|||
<pre>const <span id="Size">Size</span> = 32</pre> |
|||
<p> |
|||
The size of a SHA256 checksum in bytes. |
|||
</p> |
|||
|
|||
|
|||
<pre>const <span id="Size224">Size224</span> = 28</pre> |
|||
<p> |
|||
The size of a SHA224 checksum in bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/crypto/sha256/sha256.go?s=1643:1663#L72">New</a></h2> |
|||
<pre>func New() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new hash.Hash computing the SHA256 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New224">func <a href="http://localhost:6060/src/crypto/sha256/sha256.go?s=1773:1796#L79">New224</a></h2> |
|||
<pre>func New224() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New224 returns a new hash.Hash computing the SHA224 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum224">func <a href="http://localhost:6060/src/crypto/sha256/sha256.go?s=3420:3467#L175">Sum224</a></h2> |
|||
<pre>func Sum224(data []<a href="../../builtin/index.html#byte">byte</a>) (sum224 [<a href="index.html#Size224">Size224</a>]<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Sum224 returns the SHA224 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum256">func <a href="http://localhost:6060/src/crypto/sha256/sha256.go?s=3267:3302#L167">Sum256</a></h2> |
|||
<pre>func Sum256(data []<a href="../../builtin/index.html#byte">byte</a>) [<a href="index.html#Size">Size</a>]<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Sum256 returns the SHA256 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,352 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>sha512 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package sha512</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/sha512"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 |
|||
hash algorithms as defined in FIPS 180-4. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#New">func New() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#New384">func New384() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#New512_224">func New512_224() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#New512_256">func New512_256() hash.Hash</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum384">func Sum384(data []byte) (sum384 [Size384]byte)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum512">func Sum512(data []byte) [Size]byte</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum512_224">func Sum512_224(data []byte) (sum224 [Size224]byte)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Sum512_256">func Sum512_256(data []byte) (sum256 [Size256]byte)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha512/sha512.go">sha512.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/sha512/sha512block_decl.go">sha512block_decl.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const ( |
|||
<span class="comment">// Size is the size, in bytes, of a SHA-512 checksum.</span> |
|||
<span id="Size">Size</span> = 64 |
|||
|
|||
<span class="comment">// Size224 is the size, in bytes, of a SHA-512/224 checksum.</span> |
|||
<span id="Size224">Size224</span> = 28 |
|||
|
|||
<span class="comment">// Size256 is the size, in bytes, of a SHA-512/256 checksum.</span> |
|||
<span id="Size256">Size256</span> = 32 |
|||
|
|||
<span class="comment">// Size384 is the size, in bytes, of a SHA-384 checksum.</span> |
|||
<span id="Size384">Size384</span> = 48 |
|||
|
|||
<span class="comment">// BlockSize is the block size, in bytes, of the SHA-512/224,</span> |
|||
<span class="comment">// SHA-512/256, SHA-384 and SHA-512 hash functions.</span> |
|||
<span id="BlockSize">BlockSize</span> = 128 |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=3064:3084#L118">New</a></h2> |
|||
<pre>func New() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New returns a new hash.Hash computing the SHA-512 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New384">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=3558:3581#L139">New384</a></h2> |
|||
<pre>func New384() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New384 returns a new hash.Hash computing the SHA-384 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New512_224">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=3224:3251#L125">New512_224</a></h2> |
|||
<pre>func New512_224() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New512_224 returns a new hash.Hash computing the SHA-512/224 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New512_256">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=3395:3422#L132">New512_256</a></h2> |
|||
<pre>func New512_256() <a href="../../hash/index.html">hash</a>.<a href="../../hash/index.html#Hash">Hash</a></pre> |
|||
<p> |
|||
New512_256 returns a new hash.Hash computing the SHA-512/256 checksum. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum384">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=5702:5749#L251">Sum384</a></h2> |
|||
<pre>func Sum384(data []<a href="../../builtin/index.html#byte">byte</a>) (sum384 [<a href="index.html#Size384">Size384</a>]<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Sum384 returns the SHA384 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum512">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=5525:5560#L243">Sum512</a></h2> |
|||
<pre>func Sum512(data []<a href="../../builtin/index.html#byte">byte</a>) [<a href="index.html#Size">Size</a>]<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Sum512 returns the SHA512 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum512_224">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=5939:5990#L261">Sum512_224</a></h2> |
|||
<pre>func Sum512_224(data []<a href="../../builtin/index.html#byte">byte</a>) (sum224 [<a href="index.html#Size224">Size224</a>]<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Sum512_224 returns the Sum512/224 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sum512_256">func <a href="http://localhost:6060/src/crypto/sha512/sha512.go?s=6184:6235#L271">Sum512_256</a></h2> |
|||
<pre>func Sum512_256(data []<a href="../../builtin/index.html#byte">byte</a>) (sum256 [<a href="index.html#Size256">Size256</a>]<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Sum512_256 returns the Sum512/256 checksum of the data. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,302 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>subtle - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package subtle</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/subtle"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package subtle implements functions that are often useful in cryptographic |
|||
code but require careful thought to use correctly. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeByteEq">func ConstantTimeByteEq(x, y uint8) int</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeCompare">func ConstantTimeCompare(x, y []byte) int</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeCopy">func ConstantTimeCopy(v int, x, y []byte)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeEq">func ConstantTimeEq(x, y int32) int</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeLessOrEq">func ConstantTimeLessOrEq(x, y int) int</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ConstantTimeSelect">func ConstantTimeSelect(v, x, y int) int</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/subtle/constant_time.go">constant_time.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeByteEq">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=922:961#L21">ConstantTimeByteEq</a></h2> |
|||
<pre>func ConstantTimeByteEq(x, y <a href="../../builtin/index.html#uint8">uint8</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ConstantTimeByteEq returns 1 if x == y and 0 otherwise. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeCompare">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=490:531#L2">ConstantTimeCompare</a></h2> |
|||
<pre>func ConstantTimeCompare(x, y []<a href="../../builtin/index.html#byte">byte</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ConstantTimeCompare returns 1 iff the two slices, x |
|||
and y, have equal contents. The time taken is a function of the length of |
|||
the slices and is independent of the contents. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeCopy">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=1415:1456#L45">ConstantTimeCopy</a></h2> |
|||
<pre>func ConstantTimeCopy(v <a href="../../builtin/index.html#int">int</a>, x, y []<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
ConstantTimeCopy copies the contents of y into x (a slice of equal length) |
|||
if v == 1. If v == 0, x is left unchanged. Its behavior is undefined if v |
|||
takes any other value. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeEq">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=1092:1127#L31">ConstantTimeEq</a></h2> |
|||
<pre>func ConstantTimeEq(x, y <a href="../../builtin/index.html#int32">int32</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ConstantTimeEq returns 1 if x == y and 0 otherwise. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeLessOrEq">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=1781:1820#L59">ConstantTimeLessOrEq</a></h2> |
|||
<pre>func ConstantTimeLessOrEq(x, y <a href="../../builtin/index.html#int">int</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ConstantTimeLessOrEq returns 1 if x <= y and 0 otherwise. |
|||
Its behavior is undefined if x or y are negative or > 2**31 - 1. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantTimeSelect">func <a href="http://localhost:6060/src/crypto/subtle/constant_time.go?s=791:831#L18">ConstantTimeSelect</a></h2> |
|||
<pre>func ConstantTimeSelect(v, x, y <a href="../../builtin/index.html#int">int</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
ConstantTimeSelect returns x if v is 1 and y if v is 0. |
|||
Its behavior is undefined if v takes any other value. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1205
pkg/crypto/tls/index.html
File diff suppressed because it is too large
View File
1602
pkg/crypto/x509/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,545 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>pkix - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package pkix</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "crypto/x509/pkix"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package pkix contains shared, low level structures used for ASN.1 parsing |
|||
and serialization of X.509 certificates, CRL and OCSP. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#AlgorithmIdentifier">type AlgorithmIdentifier</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#AttributeTypeAndValue">type AttributeTypeAndValue</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#AttributeTypeAndValueSET">type AttributeTypeAndValueSET</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#CertificateList">type CertificateList</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#CertificateList.HasExpired">func (certList *CertificateList) HasExpired(now time.Time) bool</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Extension">type Extension</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Name">type Name</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Name.FillFromRDNSequence">func (n *Name) FillFromRDNSequence(rdns *RDNSequence)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Name.ToRDNSequence">func (n Name) ToRDNSequence() (ret RDNSequence)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RDNSequence">type RDNSequence</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RelativeDistinguishedNameSET">type RelativeDistinguishedNameSET</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RevokedCertificate">type RevokedCertificate</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#TBSCertificateList">type TBSCertificateList</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go">pkix.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="AlgorithmIdentifier">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=464:577#L7">AlgorithmIdentifier</a></h2> |
|||
<pre>type AlgorithmIdentifier struct { |
|||
Algorithm <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#ObjectIdentifier">ObjectIdentifier</a> |
|||
Parameters <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#RawValue">RawValue</a> `asn1:"optional"` |
|||
}</pre> |
|||
<p> |
|||
AlgorithmIdentifier represents the ASN.1 structure of the same name. See RFC |
|||
5280, section 4.1.1.2. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="AttributeTypeAndValue">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=814:899#L18">AttributeTypeAndValue</a></h2> |
|||
<pre>type AttributeTypeAndValue struct { |
|||
Type <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#ObjectIdentifier">ObjectIdentifier</a> |
|||
Value interface{} |
|||
}</pre> |
|||
<p> |
|||
AttributeTypeAndValue mirrors the ASN.1 structure of the same name in |
|||
<a href="http://tools.ietf.org/html/rfc5280#section-4.1.2.4">http://tools.ietf.org/html/rfc5280#section-4.1.2.4</a> |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="AttributeTypeAndValueSET">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=1029:1144#L25">AttributeTypeAndValueSET</a></h2> |
|||
<pre>type AttributeTypeAndValueSET struct { |
|||
Type <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#ObjectIdentifier">ObjectIdentifier</a> |
|||
Value [][]<a href="index.html#AttributeTypeAndValue">AttributeTypeAndValue</a> `asn1:"set"` |
|||
}</pre> |
|||
<p> |
|||
AttributeTypeAndValueSET represents a set of ASN.1 sequences of |
|||
AttributeTypeAndValue sequences from RFC 2986 (PKCS #10). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="CertificateList">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=4967:5112#L155">CertificateList</a></h2> |
|||
<pre>type CertificateList struct { |
|||
TBSCertList <a href="index.html#TBSCertificateList">TBSCertificateList</a> |
|||
SignatureAlgorithm <a href="index.html#AlgorithmIdentifier">AlgorithmIdentifier</a> |
|||
SignatureValue <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#BitString">BitString</a> |
|||
}</pre> |
|||
<p> |
|||
CertificateList represents the ASN.1 structure of the same name. See RFC |
|||
5280, section 5.1. Use Certificate.CheckCRLSignature to verify the |
|||
signature. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="CertificateList.HasExpired">func (*CertificateList) <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=5185:5248#L162">HasExpired</a></h3> |
|||
<pre>func (certList *<a href="index.html#CertificateList">CertificateList</a>) HasExpired(now <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
HasExpired reports whether now is past the expiry time of certList. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Extension">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=1238:1345#L32">Extension</a></h2> |
|||
<pre>type Extension struct { |
|||
Id <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#ObjectIdentifier">ObjectIdentifier</a> |
|||
Critical <a href="../../../builtin/index.html#bool">bool</a> `asn1:"optional"` |
|||
Value []<a href="../../../builtin/index.html#byte">byte</a> |
|||
}</pre> |
|||
<p> |
|||
Extension represents the ASN.1 structure of the same name. See RFC |
|||
5280, section 4.2. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Name">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=1652:1951#L42">Name</a></h2> |
|||
<pre>type Name struct { |
|||
Country, Organization, OrganizationalUnit []<a href="../../../builtin/index.html#string">string</a> |
|||
Locality, Province []<a href="../../../builtin/index.html#string">string</a> |
|||
StreetAddress, PostalCode []<a href="../../../builtin/index.html#string">string</a> |
|||
SerialNumber, CommonName <a href="../../../builtin/index.html#string">string</a> |
|||
|
|||
Names []<a href="index.html#AttributeTypeAndValue">AttributeTypeAndValue</a> |
|||
ExtraNames []<a href="index.html#AttributeTypeAndValue">AttributeTypeAndValue</a> |
|||
}</pre> |
|||
<p> |
|||
Name represents an X.509 distinguished name. This only includes the common |
|||
elements of a DN. When parsing, all elements are stored in Names and |
|||
non-standard elements can be extracted from there. When marshaling, elements |
|||
in ExtraNames are appended and override other values with the same OID. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Name.FillFromRDNSequence">func (*Name) <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=1953:2006#L52">FillFromRDNSequence</a></h3> |
|||
<pre>func (n *<a href="index.html#Name">Name</a>) FillFromRDNSequence(rdns *<a href="index.html#RDNSequence">RDNSequence</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Name.ToRDNSequence">func (Name) <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=3790:3837#L120">ToRDNSequence</a></h3> |
|||
<pre>func (n <a href="index.html#Name">Name</a>) ToRDNSequence() (ret <a href="index.html#RDNSequence">RDNSequence</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RDNSequence">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=579:626#L12">RDNSequence</a></h2> |
|||
<pre>type RDNSequence []<a href="index.html#RelativeDistinguishedNameSET">RelativeDistinguishedNameSET</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RelativeDistinguishedNameSET">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=628:685#L14">RelativeDistinguishedNameSET</a></h2> |
|||
<pre>type RelativeDistinguishedNameSET []<a href="index.html#AttributeTypeAndValue">AttributeTypeAndValue</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RevokedCertificate">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=5933:6064#L181">RevokedCertificate</a></h2> |
|||
<pre>type RevokedCertificate struct { |
|||
SerialNumber *<a href="../../../math/big/index.html">big</a>.<a href="../../../math/big/index.html#Int">Int</a> |
|||
RevocationTime <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a> |
|||
Extensions []<a href="index.html#Extension">Extension</a> `asn1:"optional"` |
|||
}</pre> |
|||
<p> |
|||
RevokedCertificate represents the ASN.1 structure of the same name. See RFC |
|||
5280, section 5.1. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="TBSCertificateList">type <a href="http://localhost:6060/src/crypto/x509/pkix/pkix.go?s=5406:5830#L168">TBSCertificateList</a></h2> |
|||
<pre>type TBSCertificateList struct { |
|||
Raw <a href="../../../encoding/asn1/index.html">asn1</a>.<a href="../../../encoding/asn1/index.html#RawContent">RawContent</a> |
|||
Version <a href="../../../builtin/index.html#int">int</a> `asn1:"optional,default:1"` |
|||
Signature <a href="index.html#AlgorithmIdentifier">AlgorithmIdentifier</a> |
|||
Issuer <a href="index.html#RDNSequence">RDNSequence</a> |
|||
ThisUpdate <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a> |
|||
NextUpdate <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a> `asn1:"optional"` |
|||
RevokedCertificates []<a href="index.html#RevokedCertificate">RevokedCertificate</a> `asn1:"optional"` |
|||
Extensions []<a href="index.html#Extension">Extension</a> `asn1:"tag:0,optional,explicit"` |
|||
}</pre> |
|||
<p> |
|||
TBSCertificateList represents the ASN.1 structure of the same name. See RFC |
|||
5280, section 5.1. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/database - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/database</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="http://localhost:6060/pkg/">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="sql/index.html">sql</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package sql provides a generic interface around SQL (or SQL-like) databases. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="sql/driver/index.html">driver</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package driver defines interfaces to be implemented by database drivers as used by package sql. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,926 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>driver - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package driver</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "database/sql/driver"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package driver defines interfaces to be implemented by database |
|||
drivers as used by package sql. |
|||
</p> |
|||
<p> |
|||
Most code should use package sql. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#IsScanValue">func IsScanValue(v interface{}) bool</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#IsValue">func IsValue(v interface{}) bool</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ColumnConverter">type ColumnConverter</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Conn">type Conn</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Driver">type Driver</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Execer">type Execer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#NotNull">type NotNull</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#NotNull.ConvertValue">func (n NotNull) ConvertValue(v interface{}) (Value, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Null">type Null</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Null.ConvertValue">func (n Null) ConvertValue(v interface{}) (Value, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Queryer">type Queryer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Result">type Result</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Rows">type Rows</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RowsAffected">type RowsAffected</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#RowsAffected.LastInsertId">func (RowsAffected) LastInsertId() (int64, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#RowsAffected.RowsAffected">func (v RowsAffected) RowsAffected() (int64, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Stmt">type Stmt</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Tx">type Tx</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Value">type Value</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ValueConverter">type ValueConverter</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Valuer">type Valuer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/database/sql/driver/driver.go">driver.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/database/sql/driver/types.go">types.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="Bool">Bool</span> boolType</pre> |
|||
<p> |
|||
Bool is a ValueConverter that converts input values to bools. |
|||
</p> |
|||
<p> |
|||
The conversion rules are: |
|||
</p> |
|||
<pre>- booleans are returned unchanged |
|||
- for integer types, |
|||
1 is true |
|||
0 is false, |
|||
other integers are an error |
|||
- for strings and []byte, same rules as strconv.ParseBool |
|||
- all other types are an error |
|||
</pre> |
|||
|
|||
|
|||
<pre>var <span id="DefaultParameterConverter">DefaultParameterConverter</span> defaultConverter</pre> |
|||
<p> |
|||
DefaultParameterConverter is the default implementation of |
|||
ValueConverter that's used when a Stmt doesn't implement |
|||
ColumnConverter. |
|||
</p> |
|||
<p> |
|||
DefaultParameterConverter returns its argument directly if |
|||
IsValue(arg). Otherwise, if the argument implements Valuer, its |
|||
Value method is used to return a Value. As a fallback, the provided |
|||
argument's underlying type is used to convert it to a Value: |
|||
underlying integer types are converted to int64, floats to float64, |
|||
and strings to []byte. If the argument is a nil pointer, |
|||
ConvertValue returns a nil Value. If the argument is a non-nil |
|||
pointer, it is dereferenced and ConvertValue is called |
|||
recursively. Other types are an error. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="ErrBadConn">ErrBadConn</span> = <a href="../../../errors/index.html">errors</a>.<a href="../../../errors/index.html#New">New</a>("driver: bad connection")</pre> |
|||
<p> |
|||
ErrBadConn should be returned by a driver to signal to the sql |
|||
package that a driver.Conn is in a bad state (such as the server |
|||
having earlier closed the connection) and the sql package should |
|||
retry on a new connection. |
|||
</p> |
|||
<p> |
|||
To prevent duplicate operations, ErrBadConn should NOT be returned |
|||
if there's a possibility that the database server might have |
|||
performed the operation. Even if the server sends back an error, |
|||
you shouldn't return ErrBadConn. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="ErrSkip">ErrSkip</span> = <a href="../../../errors/index.html">errors</a>.<a href="../../../errors/index.html#New">New</a>("driver: skip fast-path; continue as if unimplemented")</pre> |
|||
<p> |
|||
ErrSkip may be returned by some optional interfaces' methods to |
|||
indicate at runtime that the fast path is unavailable and the sql |
|||
package should continue as if the optional interface was not |
|||
implemented. ErrSkip is only supported where explicitly |
|||
documented. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="Int32">Int32</span> int32Type</pre> |
|||
<p> |
|||
Int32 is a ValueConverter that converts input values to int64, |
|||
respecting the limits of an int32 value. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="ResultNoRows">ResultNoRows</span> noRows</pre> |
|||
<p> |
|||
ResultNoRows is a pre-defined Result for drivers to return when a DDL |
|||
command (such as a CREATE TABLE) succeeds. It returns an error for both |
|||
LastInsertId and RowsAffected. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="String">String</span> stringType</pre> |
|||
<p> |
|||
String is a ValueConverter that converts its input to a string. |
|||
If the value is already a string or []byte, it's unchanged. |
|||
If the value is of another type, conversion to string is done |
|||
with fmt.Sprintf("%v", v). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="IsScanValue">func <a href="http://localhost:6060/src/database/sql/driver/types.go?s=5334:5370#L178">IsScanValue</a></h2> |
|||
<pre>func IsScanValue(v interface{}) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
IsScanValue reports whether v is a valid Value scan type. |
|||
Unlike IsValue, IsScanValue does not permit the string type. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="IsValue">func <a href="http://localhost:6060/src/database/sql/driver/types.go?s=5072:5104#L166">IsValue</a></h2> |
|||
<pre>func IsValue(v interface{}) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
IsValue reports whether v is a valid Value parameter type. |
|||
Unlike IsScanValue, IsValue permits the string type. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ColumnConverter">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=4804:5087#L135">ColumnConverter</a></h2> |
|||
<pre>type ColumnConverter interface { |
|||
<span class="comment">// ColumnConverter returns a ValueConverter for the provided</span> |
|||
<span class="comment">// column index. If the type of a specific column isn't known</span> |
|||
<span class="comment">// or shouldn't be handled specially, DefaultValueConverter</span> |
|||
<span class="comment">// can be returned.</span> |
|||
ColumnConverter(idx <a href="../../../builtin/index.html#int">int</a>) <a href="index.html#ValueConverter">ValueConverter</a> |
|||
}</pre> |
|||
<p> |
|||
ColumnConverter may be optionally implemented by Stmt if the |
|||
statement is aware of its own columns' types and can convert from |
|||
any type to a driver Value. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Conn">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=2778:3359#L73">Conn</a></h2> |
|||
<pre>type Conn interface { |
|||
<span class="comment">// Prepare returns a prepared statement, bound to this connection.</span> |
|||
Prepare(query <a href="../../../builtin/index.html#string">string</a>) (<a href="index.html#Stmt">Stmt</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
|
|||
<span class="comment">// Close invalidates and potentially stops any current</span> |
|||
<span class="comment">// prepared statements and transactions, marking this</span> |
|||
<span class="comment">// connection as no longer in use.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Because the sql package maintains a free pool of</span> |
|||
<span class="comment">// connections and only calls Close when there's a surplus of</span> |
|||
<span class="comment">// idle connections, it shouldn't be necessary for drivers to</span> |
|||
<span class="comment">// do their own connection caching.</span> |
|||
Close() <a href="../../../builtin/index.html#error">error</a> |
|||
|
|||
<span class="comment">// Begin starts and returns a new transaction.</span> |
|||
Begin() (<a href="index.html#Tx">Tx</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Conn is a connection to a database. It is not used concurrently |
|||
by multiple goroutines. |
|||
</p> |
|||
<p> |
|||
Conn is assumed to be stateful. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Driver">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=667:1088#L16">Driver</a></h2> |
|||
<pre>type Driver interface { |
|||
<span class="comment">// Open returns a new connection to the database.</span> |
|||
<span class="comment">// The name is a string in a driver-specific format.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Open may return a cached connection (one previously</span> |
|||
<span class="comment">// closed), but doing so is unnecessary; the sql package</span> |
|||
<span class="comment">// maintains a pool of idle connections for efficient re-use.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// The returned connection is only used by one goroutine at a</span> |
|||
<span class="comment">// time.</span> |
|||
Open(name <a href="../../../builtin/index.html#string">string</a>) (<a href="index.html#Conn">Conn</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Driver is the interface that must be implemented by a database |
|||
driver. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Execer">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=2231:2306#L54">Execer</a></h2> |
|||
<pre>type Execer interface { |
|||
Exec(query <a href="../../../builtin/index.html#string">string</a>, args []<a href="index.html#Value">Value</a>) (<a href="index.html#Result">Result</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Execer is an optional interface that may be implemented by a Conn. |
|||
</p> |
|||
<p> |
|||
If a Conn does not implement Execer, the sql package's DB.Exec will |
|||
first prepare a query, execute the statement, and then close the |
|||
statement. |
|||
</p> |
|||
<p> |
|||
Exec may return ErrSkip. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NotNull">type <a href="http://localhost:6060/src/database/sql/driver/types.go?s=4734:4783#L153">NotNull</a></h2> |
|||
<pre>type NotNull struct { |
|||
Converter <a href="index.html#ValueConverter">ValueConverter</a> |
|||
}</pre> |
|||
<p> |
|||
NotNull is a type that implements ValueConverter by disallowing nil |
|||
values but otherwise delegating to another ValueConverter. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NotNull.ConvertValue">func (NotNull) <a href="http://localhost:6060/src/database/sql/driver/types.go?s=4785:4844#L157">ConvertValue</a></h3> |
|||
<pre>func (n <a href="index.html#NotNull">NotNull</a>) ConvertValue(v interface{}) (<a href="index.html#Value">Value</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Null">type <a href="http://localhost:6060/src/database/sql/driver/types.go?s=4419:4465#L140">Null</a></h2> |
|||
<pre>type Null struct { |
|||
Converter <a href="index.html#ValueConverter">ValueConverter</a> |
|||
}</pre> |
|||
<p> |
|||
Null is a type that implements ValueConverter by allowing nil |
|||
values but otherwise delegating to another ValueConverter. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Null.ConvertValue">func (Null) <a href="http://localhost:6060/src/database/sql/driver/types.go?s=4467:4523#L144">ConvertValue</a></h3> |
|||
<pre>func (n <a href="index.html#Null">Null</a>) ConvertValue(v interface{}) (<a href="index.html#Value">Value</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Queryer">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=2569:2644#L65">Queryer</a></h2> |
|||
<pre>type Queryer interface { |
|||
Query(query <a href="../../../builtin/index.html#string">string</a>, args []<a href="index.html#Value">Value</a>) (<a href="index.html#Rows">Rows</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Queryer is an optional interface that may be implemented by a Conn. |
|||
</p> |
|||
<p> |
|||
If a Conn does not implement Queryer, the sql package's DB.Query will |
|||
first prepare a query, execute the statement, and then close the |
|||
statement. |
|||
</p> |
|||
<p> |
|||
Query may return ErrSkip. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Result">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=3407:3693#L92">Result</a></h2> |
|||
<pre>type Result interface { |
|||
<span class="comment">// LastInsertId returns the database's auto-generated ID</span> |
|||
<span class="comment">// after, for example, an INSERT into a table with primary</span> |
|||
<span class="comment">// key.</span> |
|||
LastInsertId() (<a href="../../../builtin/index.html#int64">int64</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
|
|||
<span class="comment">// RowsAffected returns the number of rows affected by the</span> |
|||
<span class="comment">// query.</span> |
|||
RowsAffected() (<a href="../../../builtin/index.html#int64">int64</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Result is the result of a query execution. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Rows">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=5146:5861#L144">Rows</a></h2> |
|||
<pre>type Rows interface { |
|||
<span class="comment">// Columns returns the names of the columns. The number of</span> |
|||
<span class="comment">// columns of the result is inferred from the length of the</span> |
|||
<span class="comment">// slice. If a particular column name isn't known, an empty</span> |
|||
<span class="comment">// string should be returned for that entry.</span> |
|||
Columns() []<a href="../../../builtin/index.html#string">string</a> |
|||
|
|||
<span class="comment">// Close closes the rows iterator.</span> |
|||
Close() <a href="../../../builtin/index.html#error">error</a> |
|||
|
|||
<span class="comment">// Next is called to populate the next row of data into</span> |
|||
<span class="comment">// the provided slice. The provided slice will be the same</span> |
|||
<span class="comment">// size as the Columns() are wide.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// The dest slice may be populated only with</span> |
|||
<span class="comment">// a driver Value type, but excluding string.</span> |
|||
<span class="comment">// All string values must be converted to []byte.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Next should return io.EOF when there are no more rows.</span> |
|||
Next(dest []<a href="index.html#Value">Value</a>) <a href="../../../builtin/index.html#error">error</a> |
|||
}</pre> |
|||
<p> |
|||
Rows is an iterator over an executed query's results. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RowsAffected">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=6047:6070#L174">RowsAffected</a></h2> |
|||
<pre>type RowsAffected <a href="../../../builtin/index.html#int64">int64</a></pre> |
|||
<p> |
|||
RowsAffected implements Result for an INSERT or UPDATE operation |
|||
which mutates a number of rows. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="RowsAffected.LastInsertId">func (RowsAffected) <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=6104:6153#L178">LastInsertId</a></h3> |
|||
<pre>func (<a href="index.html#RowsAffected">RowsAffected</a>) LastInsertId() (<a href="../../../builtin/index.html#int64">int64</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="RowsAffected.RowsAffected">func (RowsAffected) <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=6210:6261#L182">RowsAffected</a></h3> |
|||
<pre>func (v <a href="index.html#RowsAffected">RowsAffected</a>) RowsAffected() (<a href="../../../builtin/index.html#int64">int64</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Stmt">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=3803:4638#L105">Stmt</a></h2> |
|||
<pre>type Stmt interface { |
|||
<span class="comment">// Close closes the statement.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// As of Go 1.1, a Stmt will not be closed if it's in use</span> |
|||
<span class="comment">// by any queries.</span> |
|||
Close() <a href="../../../builtin/index.html#error">error</a> |
|||
|
|||
<span class="comment">// NumInput returns the number of placeholder parameters.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// If NumInput returns >= 0, the sql package will sanity check</span> |
|||
<span class="comment">// argument counts from callers and return errors to the caller</span> |
|||
<span class="comment">// before the statement's Exec or Query methods are called.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// NumInput may also return -1, if the driver doesn't know</span> |
|||
<span class="comment">// its number of placeholders. In that case, the sql package</span> |
|||
<span class="comment">// will not sanity check Exec or Query argument counts.</span> |
|||
NumInput() <a href="../../../builtin/index.html#int">int</a> |
|||
|
|||
<span class="comment">// Exec executes a query that doesn't return rows, such</span> |
|||
<span class="comment">// as an INSERT or UPDATE.</span> |
|||
Exec(args []<a href="index.html#Value">Value</a>) (<a href="index.html#Result">Result</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
|
|||
<span class="comment">// Query executes a query that may return rows, such as a</span> |
|||
<span class="comment">// SELECT.</span> |
|||
Query(args []<a href="index.html#Value">Value</a>) (<a href="index.html#Rows">Rows</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Stmt is a prepared statement. It is bound to a Conn and not |
|||
used by multiple goroutines concurrently. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Tx">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=5887:5942#L167">Tx</a></h2> |
|||
<pre>type Tx interface { |
|||
Commit() <a href="../../../builtin/index.html#error">error</a> |
|||
Rollback() <a href="../../../builtin/index.html#error">error</a> |
|||
}</pre> |
|||
<p> |
|||
Tx is a transaction. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Value">type <a href="http://localhost:6060/src/database/sql/driver/driver.go?s=566:588#L12">Value</a></h2> |
|||
<pre>type Value interface{}</pre> |
|||
<p> |
|||
Value is a value that drivers must be able to handle. |
|||
It is either nil or an instance of one of these types: |
|||
</p> |
|||
<pre>int64 |
|||
float64 |
|||
bool |
|||
[]byte |
|||
string [*] everywhere except from Rows.Next. |
|||
time.Time |
|||
</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ValueConverter">type <a href="http://localhost:6060/src/database/sql/driver/types.go?s=928:1058#L20">ValueConverter</a></h2> |
|||
<pre>type ValueConverter interface { |
|||
<span class="comment">// ConvertValue converts a value to a driver Value.</span> |
|||
ConvertValue(v interface{}) (<a href="index.html#Value">Value</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
ValueConverter is the interface providing the ConvertValue method. |
|||
</p> |
|||
<p> |
|||
Various implementations of ValueConverter are provided by the |
|||
driver package to provide consistent implementations of conversions |
|||
between drivers. The ValueConverters have several uses: |
|||
</p> |
|||
<pre>* converting from the Value types as provided by the sql package |
|||
into a database table's specific column type and making sure it |
|||
fits, such as making sure a particular int64 fits in a |
|||
table's uint16 column. |
|||
|
|||
* converting a value as given from the database into one of the |
|||
driver Value types. |
|||
|
|||
* by the sql package, for converting from a driver's Value type |
|||
to a user's type in a scan. |
|||
</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Valuer">type <a href="http://localhost:6060/src/database/sql/driver/types.go?s=1210:1293#L29">Valuer</a></h2> |
|||
<pre>type Valuer interface { |
|||
<span class="comment">// Value returns a driver Value.</span> |
|||
Value() (<a href="index.html#Value">Value</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Valuer is the interface providing the Value method. |
|||
</p> |
|||
<p> |
|||
Types implementing Valuer interface are able to convert |
|||
themselves to a driver Value. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1521
pkg/database/sql/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,674 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>asn1 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package asn1</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "encoding/asn1"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package asn1 implements parsing of DER-encoded ASN.1 data structures, |
|||
as defined in ITU-T Rec X.690. |
|||
</p> |
|||
<p> |
|||
See also “A Layman's Guide to a Subset of ASN.1, BER, and DER,” |
|||
<a href="http://luca.ntop.org/Teaching/Appunti/asn1.html">http://luca.ntop.org/Teaching/Appunti/asn1.html</a>. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Marshal">func Marshal(val interface{}) ([]byte, error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Unmarshal">func Unmarshal(b []byte, val interface{}) (rest []byte, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#UnmarshalWithParams">func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#BitString">type BitString</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#BitString.At">func (b BitString) At(i int) int</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BitString.RightAlign">func (b BitString) RightAlign() []byte</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Enumerated">type Enumerated</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Flag">type Flag</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ObjectIdentifier">type ObjectIdentifier</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ObjectIdentifier.Equal">func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ObjectIdentifier.String">func (oi ObjectIdentifier) String() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RawContent">type RawContent</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RawValue">type RawValue</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#StructuralError">type StructuralError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#StructuralError.Error">func (e StructuralError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#SyntaxError">type SyntaxError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#SyntaxError.Error">func (e SyntaxError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/encoding/asn1/asn1.go">asn1.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/encoding/asn1/common.go">common.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/encoding/asn1/marshal.go">marshal.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const ( |
|||
<span id="TagBoolean">TagBoolean</span> = 1 |
|||
<span id="TagInteger">TagInteger</span> = 2 |
|||
<span id="TagBitString">TagBitString</span> = 3 |
|||
<span id="TagOctetString">TagOctetString</span> = 4 |
|||
<span id="TagOID">TagOID</span> = 6 |
|||
<span id="TagEnum">TagEnum</span> = 10 |
|||
<span id="TagUTF8String">TagUTF8String</span> = 12 |
|||
<span id="TagSequence">TagSequence</span> = 16 |
|||
<span id="TagSet">TagSet</span> = 17 |
|||
<span id="TagPrintableString">TagPrintableString</span> = 19 |
|||
<span id="TagT61String">TagT61String</span> = 20 |
|||
<span id="TagIA5String">TagIA5String</span> = 22 |
|||
<span id="TagUTCTime">TagUTCTime</span> = 23 |
|||
<span id="TagGeneralizedTime">TagGeneralizedTime</span> = 24 |
|||
<span id="TagGeneralString">TagGeneralString</span> = 27 |
|||
)</pre> |
|||
<p> |
|||
ASN.1 tags represent the type of the following object. |
|||
</p> |
|||
|
|||
|
|||
<pre>const ( |
|||
<span id="ClassUniversal">ClassUniversal</span> = 0 |
|||
<span id="ClassApplication">ClassApplication</span> = 1 |
|||
<span id="ClassContextSpecific">ClassContextSpecific</span> = 2 |
|||
<span id="ClassPrivate">ClassPrivate</span> = 3 |
|||
)</pre> |
|||
<p> |
|||
ASN.1 class types represent the namespace of the tag. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Marshal">func <a href="http://localhost:6060/src/encoding/asn1/marshal.go?s=13656:13701#L635">Marshal</a></h2> |
|||
<pre>func Marshal(val interface{}) ([]<a href="../../builtin/index.html#byte">byte</a>, <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Marshal returns the ASN.1 encoding of val. |
|||
</p> |
|||
<p> |
|||
In addition to the struct tags recognised by Unmarshal, the following can be |
|||
used: |
|||
</p> |
|||
<pre>ia5: causes strings to be marshaled as ASN.1, IA5 strings |
|||
omitempty: causes empty slices to be skipped |
|||
printable: causes strings to be marshaled as ASN.1, PrintableString strings. |
|||
utf8: causes strings to be marshaled as ASN.1, UTF8 strings |
|||
</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Unmarshal">func <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=27223:27289#L972">Unmarshal</a></h2> |
|||
<pre>func Unmarshal(b []<a href="../../builtin/index.html#byte">byte</a>, val interface{}) (rest []<a href="../../builtin/index.html#byte">byte</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Unmarshal parses the DER-encoded ASN.1 data structure b |
|||
and uses the reflect package to fill in an arbitrary value pointed at by val. |
|||
Because Unmarshal uses the reflect package, the structs |
|||
being written to must use upper case field names. |
|||
</p> |
|||
<p> |
|||
An ASN.1 INTEGER can be written to an int, int32, int64, |
|||
or *big.Int (from the math/big package). |
|||
If the encoded value does not fit in the Go type, |
|||
Unmarshal returns a parse error. |
|||
</p> |
|||
<p> |
|||
An ASN.1 BIT STRING can be written to a BitString. |
|||
</p> |
|||
<p> |
|||
An ASN.1 OCTET STRING can be written to a []byte. |
|||
</p> |
|||
<p> |
|||
An ASN.1 OBJECT IDENTIFIER can be written to an |
|||
ObjectIdentifier. |
|||
</p> |
|||
<p> |
|||
An ASN.1 ENUMERATED can be written to an Enumerated. |
|||
</p> |
|||
<p> |
|||
An ASN.1 UTCTIME or GENERALIZEDTIME can be written to a time.Time. |
|||
</p> |
|||
<p> |
|||
An ASN.1 PrintableString or IA5String can be written to a string. |
|||
</p> |
|||
<p> |
|||
Any of the above ASN.1 values can be written to an interface{}. |
|||
The value stored in the interface has the corresponding Go type. |
|||
For integers, that type is int64. |
|||
</p> |
|||
<p> |
|||
An ASN.1 SEQUENCE OF x or SET OF x can be written |
|||
to a slice if an x can be written to the slice's element type. |
|||
</p> |
|||
<p> |
|||
An ASN.1 SEQUENCE or SET can be written to a struct |
|||
if each of the elements in the sequence can be |
|||
written to the corresponding element in the struct. |
|||
</p> |
|||
<p> |
|||
The following tags on struct fields have special meaning to Unmarshal: |
|||
</p> |
|||
<pre>application specifies that a APPLICATION tag is used |
|||
default:x sets the default value for optional integer fields |
|||
explicit specifies that an additional, explicit tag wraps the implicit one |
|||
optional marks the field as ASN.1 OPTIONAL |
|||
set causes a SET, rather than a SEQUENCE type to be expected |
|||
tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC |
|||
</pre> |
|||
<p> |
|||
If the type of the first field of a structure is RawContent then the raw |
|||
ASN1 contents of the struct will be stored in it. |
|||
</p> |
|||
<p> |
|||
If the type name of a slice element ends with "SET" then it's treated as if |
|||
the "set" tag was set on it. This can be used with nested slices where a |
|||
struct tag cannot be given. |
|||
</p> |
|||
<p> |
|||
Other ASN.1 types are not supported; if it encounters them, |
|||
Unmarshal returns a parse error. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="UnmarshalWithParams">func <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=27482:27573#L978">UnmarshalWithParams</a></h2> |
|||
<pre>func UnmarshalWithParams(b []<a href="../../builtin/index.html#byte">byte</a>, val interface{}, params <a href="../../builtin/index.html#string">string</a>) (rest []<a href="../../builtin/index.html#byte">byte</a>, err <a href="../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
UnmarshalWithParams allows field parameters to be specified for the |
|||
top-level element. The form of the params is the same as the field tags. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="BitString">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=4186:4293#L147">BitString</a></h2> |
|||
<pre>type BitString struct { |
|||
Bytes []<a href="../../builtin/index.html#byte">byte</a> <span class="comment">// bits packed into bytes.</span> |
|||
BitLength <a href="../../builtin/index.html#int">int</a> <span class="comment">// length in bits.</span> |
|||
}</pre> |
|||
<p> |
|||
BitString is the structure to use when you want an ASN.1 BIT STRING type. A |
|||
bit string is padded up to the nearest byte in memory and the number of |
|||
valid bits is recorded. Padding bits will be zero. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BitString.At">func (BitString) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=4387:4419#L154">At</a></h3> |
|||
<pre>func (b <a href="index.html#BitString">BitString</a>) At(i <a href="../../builtin/index.html#int">int</a>) <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
At returns the bit at the given index. If the index is out of range it |
|||
returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BitString.RightAlign">func (BitString) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=4659:4697#L165">RightAlign</a></h3> |
|||
<pre>func (b <a href="index.html#BitString">BitString</a>) RightAlign() []<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
RightAlign returns a slice where the padding bits are at the beginning. The |
|||
slice may share memory with the BitString. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Enumerated">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=7186:7205#L275">Enumerated</a></h2> |
|||
<pre>type Enumerated <a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
An Enumerated is represented as a plain int. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Flag">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=7274:7288#L280">Flag</a></h2> |
|||
<pre>type Flag <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
A Flag accepts any data and is set to true if present. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ObjectIdentifier">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=5585:5612#L202">ObjectIdentifier</a></h2> |
|||
<pre>type ObjectIdentifier []<a href="../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ObjectIdentifier.Equal">func (ObjectIdentifier) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=5683:5744#L205">Equal</a></h3> |
|||
<pre>func (oi <a href="index.html#ObjectIdentifier">ObjectIdentifier</a>) Equal(other <a href="index.html#ObjectIdentifier">ObjectIdentifier</a>) <a href="../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Equal reports whether oi and other represent the same identifier. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ObjectIdentifier.String">func (ObjectIdentifier) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=5890:5932#L218">String</a></h3> |
|||
<pre>func (oi <a href="index.html#ObjectIdentifier">ObjectIdentifier</a>) String() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RawContent">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=11130:11152#L425">RawContent</a></h2> |
|||
<pre>type RawContent []<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
RawContent is used to signal that the undecoded, DER data needs to be |
|||
preserved for a struct. To use it, the first field of the struct must have |
|||
this type. It's an error for any of the other fields to have this type. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RawValue">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=10776:10902#L415">RawValue</a></h2> |
|||
<pre>type RawValue struct { |
|||
Class, Tag <a href="../../builtin/index.html#int">int</a> |
|||
IsCompound <a href="../../builtin/index.html#bool">bool</a> |
|||
Bytes []<a href="../../builtin/index.html#byte">byte</a> |
|||
FullBytes []<a href="../../builtin/index.html#byte">byte</a> <span class="comment">// includes the tag and length</span> |
|||
}</pre> |
|||
<p> |
|||
A RawValue represents an undecoded ASN.1 object. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="StructuralError">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=1169:1212#L24">StructuralError</a></h2> |
|||
<pre>type StructuralError struct { |
|||
Msg <a href="../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
A StructuralError suggests that the ASN.1 data is valid, but the Go type |
|||
which is receiving it doesn't match. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="StructuralError.Error">func (StructuralError) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=1214:1253#L28">Error</a></h3> |
|||
<pre>func (e <a href="index.html#StructuralError">StructuralError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="SyntaxError">type <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=1358:1397#L31">SyntaxError</a></h2> |
|||
<pre>type SyntaxError struct { |
|||
Msg <a href="../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
A SyntaxError suggests that the ASN.1 data is invalid. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="SyntaxError.Error">func (SyntaxError) <a href="http://localhost:6060/src/encoding/asn1/asn1.go?s=1399:1434#L35">Error</a></h3> |
|||
<pre>func (e <a href="index.html#SyntaxError">SyntaxError</a>) Error() <a href="../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1655
pkg/encoding/json/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,288 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>pem - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package pem</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "encoding/pem"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package pem implements the PEM data encoding, which originated in Privacy |
|||
Enhanced Mail. The most common use of PEM encoding today is in TLS keys and |
|||
certificates. See RFC 1421. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Encode">func Encode(out io.Writer, b *Block) error</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#EncodeToMemory">func EncodeToMemory(b *Block) []byte</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Block">type Block</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Decode">func Decode(data []byte) (p *Block, rest []byte)</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/encoding/pem/pem.go">pem.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Encode">func <a href="http://localhost:6060/src/encoding/pem/pem.go?s=5906:5948#L222">Encode</a></h2> |
|||
<pre>func Encode(out <a href="../../io/index.html">io</a>.<a href="../../io/index.html#Writer">Writer</a>, b *<a href="index.html#Block">Block</a>) <a href="../../builtin/index.html#error">error</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="EncodeToMemory">func <a href="http://localhost:6060/src/encoding/pem/pem.go?s=7241:7277#L280">EncodeToMemory</a></h2> |
|||
<pre>func EncodeToMemory(b *<a href="index.html#Block">Block</a>) []<a href="../../builtin/index.html#byte">byte</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Block">type <a href="http://localhost:6060/src/encoding/pem/pem.go?s=669:934#L17">Block</a></h2> |
|||
<pre>type Block struct { |
|||
Type <a href="../../builtin/index.html#string">string</a> <span class="comment">// The type, taken from the preamble (i.e. "RSA PRIVATE KEY").</span> |
|||
Headers map[<a href="../../builtin/index.html#string">string</a>]<a href="../../builtin/index.html#string">string</a> <span class="comment">// Optional headers.</span> |
|||
Bytes []<a href="../../builtin/index.html#byte">byte</a> <span class="comment">// The decoded bytes of the contents. Typically a DER encoded ASN.1 structure.</span> |
|||
}</pre> |
|||
<p> |
|||
A Block represents a PEM encoded structure. |
|||
</p> |
|||
<p> |
|||
The encoded form is: |
|||
</p> |
|||
<pre>-----BEGIN Type----- |
|||
Headers |
|||
base64-encoded Bytes |
|||
-----END Type----- |
|||
</pre> |
|||
<p> |
|||
where Headers is a possibly empty sequence of Key: Value lines. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Decode">func <a href="http://localhost:6060/src/encoding/pem/pem.go?s=2203:2251#L68">Decode</a></h3> |
|||
<pre>func Decode(data []<a href="../../builtin/index.html#byte">byte</a>) (p *<a href="index.html#Block">Block</a>, rest []<a href="../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Decode will find the next PEM formatted block (certificate, private key |
|||
etc) in the input. It returns that block and the remainder of the input. If |
|||
no PEM data is found, p is nil and the whole of the input is returned in |
|||
rest. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1709
pkg/encoding/xml/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,329 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>errors - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package errors</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "errors"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package errors implements functions to manipulate errors. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
<div id="example_" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">package errors_test |
|||
|
|||
import ( |
|||
"fmt" |
|||
"time" |
|||
) |
|||
|
|||
<span class="comment">// MyError is an error implementation that includes a time and message.</span> |
|||
type MyError struct { |
|||
When time.Time |
|||
What string |
|||
} |
|||
|
|||
func (e MyError) Error() string { |
|||
return fmt.Sprintf("%v: %v", e.When, e.What) |
|||
} |
|||
|
|||
func oops() error { |
|||
return MyError{ |
|||
time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), |
|||
"the file system has gone away", |
|||
} |
|||
} |
|||
|
|||
func Example() { |
|||
if err := oops(); err != nil { |
|||
fmt.Println(err) |
|||
} |
|||
<span class="comment">// Output: 1989-03-15 22:30:00 +0000 UTC: the file system has gone away</span> |
|||
} |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#New">func New(text string) error</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_">Package</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_New">New</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_New_errorf">New (Errorf)</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/errors/errors.go">errors.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="New">func <a href="http://localhost:6060/src/errors/errors.go?s=294:321#L1">New</a></h2> |
|||
<pre>func New(text <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
New returns an error that formats as the given text. |
|||
</p> |
|||
|
|||
<div id="example_New" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">err := errors.New("emit macho dwarf: elf header corrupted") |
|||
if err != nil { |
|||
fmt.Print(err) |
|||
} |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">emit macho dwarf: elf header corrupted |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
<div id="example_New_errorf" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example (Errorf)</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example (Errorf)</span></p> |
|||
<p>The fmt package's Errorf function lets us use the package's formatting |
|||
features to create descriptive error messages. |
|||
</p> |
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">const name, id = "bimmler", 17 |
|||
err := fmt.Errorf("user %q (id %d) not found", name, id) |
|||
if err != nil { |
|||
fmt.Print(err) |
|||
} |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">user "bimmler" (id 17) not found |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1561
pkg/flag/index.html
File diff suppressed because it is too large
View File
1148
pkg/fmt/index.html
File diff suppressed because it is too large
View File
3288
pkg/github.com/PuerkitoBio/goquery/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/PuerkitoBio - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/PuerkitoBio</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="goquery/index.html">goquery</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package goquery implements features similar to jQuery, including the chainable syntax, to manipulate and query an HTML document. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,196 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/Sirupsen - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/Sirupsen</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="logrus/index.html">logrus</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package logrus is a structured logger for Go, completely API compatible with the standard library logger. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="logrus/examples/index.html">examples</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 40px;"> |
|||
<a href="logrus/examples/basic/index.html">basic</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 40px;"> |
|||
<a href="logrus/examples/hook/index.html">hook</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="logrus/hooks/index.html">hooks</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 40px;"> |
|||
<a href="logrus/hooks/syslog/index.html">syslog</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 40px;"> |
|||
<a href="logrus/hooks/test/index.html">test</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,106 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>basic - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Command basic</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,106 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>hook - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Command hook</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/Sirupsen/logrus/examples - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/Sirupsen/logrus/examples</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="basic/index.html">basic</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="hook/index.html">hook</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/Sirupsen/logrus/hooks - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/Sirupsen/logrus/hooks</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="syslog/index.html">syslog</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="test/index.html">test</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,269 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>logrus_syslog - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package logrus_syslog</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/Sirupsen/logrus/hooks/syslog"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#SyslogHook">type SyslogHook</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewSyslogHook">func NewSyslogHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#SyslogHook.Fire">func (hook *SyslogHook) Fire(entry *logrus.Entry) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#SyslogHook.Levels">func (hook *SyslogHook) Levels() []logrus.Level</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go">syslog.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="SyslogHook">type <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go?s=164:264#L3">SyslogHook</a></h2> |
|||
<pre>type SyslogHook struct { |
|||
Writer *<a href="../../../../../log/syslog/index.html">syslog</a>.<a href="../../../../../log/syslog/index.html#Writer">Writer</a> |
|||
SyslogNetwork <a href="../../../../../builtin/index.html#string">string</a> |
|||
SyslogRaddr <a href="../../../../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
SyslogHook to send logs via syslog. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewSyslogHook">func <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go?s=463:563#L12">NewSyslogHook</a></h3> |
|||
<pre>func NewSyslogHook(network, raddr <a href="../../../../../builtin/index.html#string">string</a>, priority <a href="../../../../../log/syslog/index.html">syslog</a>.<a href="../../../../../log/syslog/index.html#Priority">Priority</a>, tag <a href="../../../../../builtin/index.html#string">string</a>) (*<a href="index.html#SyslogHook">SyslogHook</a>, <a href="../../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Creates a hook to be added to an instance of logger. This is called with |
|||
`hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")` |
|||
`if err == nil { log.Hooks.Add(hook) }` |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="SyslogHook.Fire">func (*SyslogHook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go?s=667:722#L17">Fire</a></h3> |
|||
<pre>func (hook *<a href="index.html#SyslogHook">SyslogHook</a>) Fire(entry *<a href="../../index.html">logrus</a>.<a href="../../index.html#Entry">Entry</a>) <a href="../../../../../builtin/index.html#error">error</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="SyslogHook.Levels">func (*SyslogHook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/syslog/syslog.go?s=1240:1287#L42">Levels</a></h3> |
|||
<pre>func (hook *<a href="index.html#SyslogHook">SyslogHook</a>) Levels() []<a href="../../index.html">logrus</a>.<a href="../../index.html#Level">Level</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,321 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>test - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package test</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/Sirupsen/logrus/hooks/test"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#NewNullLogger">func NewNullLogger() (*logrus.Logger, *Hook)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Hook">type Hook</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewGlobal">func NewGlobal() *Hook</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewLocal">func NewLocal(logger *logrus.Logger) *Hook</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Hook.Fire">func (t *Hook) Fire(e *logrus.Entry) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hook.LastEntry">func (t *Hook) LastEntry() (l *logrus.Entry)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hook.Levels">func (t *Hook) Levels() []logrus.Level</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Hook.Reset">func (t *Hook) Reset()</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go">test.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NewNullLogger">func <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=538:582#L25">NewNullLogger</a></h2> |
|||
<pre>func NewNullLogger() (*<a href="../../index.html">logrus</a>.<a href="../../index.html#Logger">Logger</a>, *<a href="index.html#Hook">Hook</a>)</pre> |
|||
<p> |
|||
Creates a discarding logger and installs the test hook. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Hook">type <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=143:188#L1">Hook</a></h2> |
|||
<pre>type Hook struct { |
|||
Entries []*<a href="../../index.html">logrus</a>.<a href="../../index.html#Entry">Entry</a> |
|||
}</pre> |
|||
<p> |
|||
test.Hook is a hook designed for dealing with logs in test scenarios. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewGlobal">func <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=237:259#L5">NewGlobal</a></h3> |
|||
<pre>func NewGlobal() *<a href="index.html#Hook">Hook</a></pre> |
|||
<p> |
|||
Installs a test hook for the global logger. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewLocal">func <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=372:414#L15">NewLocal</a></h3> |
|||
<pre>func NewLocal(logger *<a href="../../index.html">logrus</a>.<a href="../../index.html#Logger">Logger</a>) *<a href="index.html#Hook">Hook</a></pre> |
|||
<p> |
|||
Installs a test hook for a given local logger. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hook.Fire">func (*Hook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=677:719#L34">Fire</a></h3> |
|||
<pre>func (t *<a href="index.html#Hook">Hook</a>) Fire(e *<a href="../../index.html">logrus</a>.<a href="../../index.html#Entry">Entry</a>) <a href="../../../../../builtin/index.html#error">error</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hook.LastEntry">func (*Hook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=900:944#L44">LastEntry</a></h3> |
|||
<pre>func (t *<a href="index.html#Hook">Hook</a>) LastEntry() (l *<a href="../../index.html">logrus</a>.<a href="../../index.html#Entry">Entry</a>)</pre> |
|||
<p> |
|||
LastEntry returns the last entry that was logged or nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hook.Levels">func (*Hook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=771:809#L39">Levels</a></h3> |
|||
<pre>func (t *<a href="index.html#Hook">Hook</a>) Levels() []<a href="../../index.html">logrus</a>.<a href="../../index.html#Level">Level</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Hook.Reset">func (*Hook) <a href="http://localhost:6060/src/github.com/Sirupsen/logrus/hooks/test/test.go?s=1087:1109#L55">Reset</a></h3> |
|||
<pre>func (t *<a href="index.html#Hook">Hook</a>) Reset()</pre> |
|||
<p> |
|||
Reset removes all Entries from this test hook. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
2160
pkg/github.com/Sirupsen/logrus/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,214 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>fuzz - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package fuzz</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/andybalholm/cascadia/fuzz"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Fuzz">func Fuzz(data []byte) int</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/andybalholm/cascadia/fuzz/fuzz.go">fuzz.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Fuzz">func <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/fuzz/fuzz.go?s=56:82#L1">Fuzz</a></h2> |
|||
<pre>func Fuzz(data []<a href="../../../../builtin/index.html#byte">byte</a>) <a href="../../../../builtin/index.html#int">int</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,357 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>cascadia - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package cascadia</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/andybalholm/cascadia"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
The cascadia package is an implementation of CSS selectors. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Selector">type Selector</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Compile">func Compile(sel string) (Selector, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#MustCompile">func MustCompile(sel string) Selector</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Selector.Filter">func (s Selector) Filter(nodes []*html.Node) (result []*html.Node)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Selector.Match">func (s Selector) Match(n *html.Node) bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Selector.MatchAll">func (s Selector) MatchAll(n *html.Node) []*html.Node</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Selector.MatchFirst">func (s Selector) MatchFirst(n *html.Node) *html.Node</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/andybalholm/cascadia/parser.go">parser.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go">selector.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Selector">type <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=219:254#L5">Selector</a></h2> |
|||
<pre>type Selector func(*<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
A Selector is a function which tells whether a node matches or not. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Compile">func <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=1022:1064#L31">Compile</a></h3> |
|||
<pre>func Compile(sel <a href="../../../builtin/index.html#string">string</a>) (<a href="index.html#Selector">Selector</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Compile parses a selector and returns, if successful, a Selector object |
|||
that can be used to match against html.Node objects. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MustCompile">func <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=1371:1408#L46">MustCompile</a></h3> |
|||
<pre>func MustCompile(sel <a href="../../../builtin/index.html#string">string</a>) <a href="index.html#Selector">Selector</a></pre> |
|||
<p> |
|||
MustCompile is like Compile, but panics instead of returning an error. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Selector.Filter">func (Selector) <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=2415:2481#L93">Filter</a></h3> |
|||
<pre>func (s <a href="index.html#Selector">Selector</a>) Filter(nodes []*<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>) (result []*<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>)</pre> |
|||
<p> |
|||
Filter returns the nodes in nodes that match the selector. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Selector.Match">func (Selector) <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=1999:2041#L73">Match</a></h3> |
|||
<pre>func (s <a href="index.html#Selector">Selector</a>) Match(n *<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Match returns true if the node matches the selector. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Selector.MatchAll">func (Selector) <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=1589:1642#L56">MatchAll</a></h3> |
|||
<pre>func (s <a href="index.html#Selector">Selector</a>) MatchAll(n *<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>) []*<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a></pre> |
|||
<p> |
|||
MatchAll returns a slice of the nodes that match the selector, |
|||
from n and its children. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Selector.MatchFirst">func (Selector) <a href="http://localhost:6060/src/github.com/andybalholm/cascadia/selector.go?s=2138:2191#L78">MatchFirst</a></h3> |
|||
<pre>func (s <a href="index.html#Selector">Selector</a>) MatchFirst(n *<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a>) *<a href="../../../golang.org/x/net/html/index.html">html</a>.<a href="../../../golang.org/x/net/html/index.html#Node">Node</a></pre> |
|||
<p> |
|||
MatchFirst returns the first node that matches s, from n and its children. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-subdirectories">Subdirectories</h2> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="fuzz/index.html">fuzz</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/andybalholm - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/andybalholm</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="cascadia/index.html">cascadia</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
The cascadia package is an implementation of CSS selectors. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="cascadia/fuzz/index.html">fuzz</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
2338
pkg/github.com/andygrunwald/go-jira/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/andygrunwald - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/andygrunwald</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="go-jira/index.html">go-jira</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/beorn7 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/beorn7</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="perks/index.html">perks</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="perks/quantile/index.html">quantile</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/beorn7/perks - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/beorn7/perks</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="quantile/index.html">quantile</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,630 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>quantile - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package quantile</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/beorn7/perks/quantile"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package quantile computes approximate quantiles over an unbounded data |
|||
stream within low memory and CPU bounds. |
|||
</p> |
|||
<p> |
|||
A small amount of accuracy is traded to achieve the above properties. |
|||
</p> |
|||
<p> |
|||
Multiple streams can be merged before calling Query to generate a single set |
|||
of results. This is meaningful when the streams represent the same type of |
|||
data. See Merge and Samples. |
|||
</p> |
|||
<p> |
|||
For more detailed information about the algorithm used, see: |
|||
</p> |
|||
<h3 id="hdr-Effective_Computation_of_Biased_Quantiles_over_Data_Streams">Effective Computation of Biased Quantiles over Data Streams</h3> |
|||
<p> |
|||
<a href="http://www.cs.rutgers.edu/~muthu/bquant.pdf">http://www.cs.rutgers.edu/~muthu/bquant.pdf</a> |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
<div id="example__mergeMultipleStreams" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example (MergeMultipleStreams)</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example (MergeMultipleStreams)</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code"> |
|||
<span class="comment">// Scenario:</span> |
|||
<span class="comment">// We have multiple database shards. On each shard, there is a process</span> |
|||
<span class="comment">// collecting query response times from the database logs and inserting</span> |
|||
<span class="comment">// them into a Stream (created via NewTargeted(0.90)), much like the</span> |
|||
<span class="comment">// Simple example. These processes expose a network interface for us to</span> |
|||
<span class="comment">// ask them to serialize and send us the results of their</span> |
|||
<span class="comment">// Stream.Samples so we may Merge and Query them.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// NOTES:</span> |
|||
<span class="comment">// * These sample sets are small, allowing us to get them</span> |
|||
<span class="comment">// across the network much faster than sending the entire list of data</span> |
|||
<span class="comment">// points.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// * For this to work correctly, we must supply the same quantiles</span> |
|||
<span class="comment">// a priori the process collecting the samples supplied to NewTargeted,</span> |
|||
<span class="comment">// even if we do not plan to query them all here.</span> |
|||
ch := make(chan quantile.Samples) |
|||
getDBQuerySamples(ch) |
|||
q := quantile.NewTargeted(map[float64]float64{0.90: 0.001}) |
|||
for samples := range ch { |
|||
q.Merge(samples) |
|||
} |
|||
fmt.Println("perc90:", q.Query(0.90)) |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
<div id="example__simple" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example (Simple)</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example (Simple)</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">ch := make(chan float64) |
|||
go sendFloats(ch) |
|||
|
|||
<span class="comment">// Compute the 50th, 90th, and 99th percentile.</span> |
|||
q := quantile.NewTargeted(map[float64]float64{ |
|||
0.50: 0.005, |
|||
0.90: 0.001, |
|||
0.99: 0.0001, |
|||
}) |
|||
for v := range ch { |
|||
q.Insert(v) |
|||
} |
|||
|
|||
fmt.Println("perc50:", q.Query(0.50)) |
|||
fmt.Println("perc90:", q.Query(0.90)) |
|||
fmt.Println("perc99:", q.Query(0.99)) |
|||
fmt.Println("count:", q.Count()) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">perc50: 5 |
|||
perc90: 16 |
|||
perc99: 223 |
|||
count: 2388 |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
<div id="example__window" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example (Window)</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example (Window)</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code"> |
|||
<span class="comment">// Scenario: We want the 90th, 95th, and 99th percentiles for each</span> |
|||
<span class="comment">// minute.</span> |
|||
|
|||
ch := make(chan float64) |
|||
go sendStreamValues(ch) |
|||
|
|||
tick := time.NewTicker(1 * time.Minute) |
|||
q := quantile.NewTargeted(map[float64]float64{ |
|||
0.90: 0.001, |
|||
0.95: 0.0005, |
|||
0.99: 0.0001, |
|||
}) |
|||
for { |
|||
select { |
|||
case t := <-tick.C: |
|||
flushToDB(t, q.Samples()) |
|||
q.Reset() |
|||
case v := <-ch: |
|||
q.Insert(v) |
|||
} |
|||
} |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Sample">type Sample</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Samples">type Samples</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Samples.Len">func (a Samples) Len() int</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Samples.Less">func (a Samples) Less(i, j int) bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Samples.Swap">func (a Samples) Swap(i, j int)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Stream">type Stream</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewHighBiased">func NewHighBiased(epsilon float64) *Stream</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewLowBiased">func NewLowBiased(epsilon float64) *Stream</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewTargeted">func NewTargeted(targets map[float64]float64) *Stream</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Count">func (s *Stream) Count() int</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Insert">func (s *Stream) Insert(v float64)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Merge">func (s *Stream) Merge(samples Samples)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Query">func (s *Stream) Query(q float64) float64</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Reset">func (s *Stream) Reset()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Stream.Samples">func (s *Stream) Samples() Samples</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example__mergeMultipleStreams">Package (MergeMultipleStreams)</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example__simple">Package (Simple)</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example__window">Package (Window)</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go">stream.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sample">type <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=734:852#L14">Sample</a></h2> |
|||
<pre>type Sample struct { |
|||
Value <a href="../../../../builtin/index.html#float64">float64</a> `json:",string"` |
|||
Width <a href="../../../../builtin/index.html#float64">float64</a> `json:",string"` |
|||
Delta <a href="../../../../builtin/index.html#float64">float64</a> `json:",string"` |
|||
}</pre> |
|||
<p> |
|||
Sample holds an observed value and meta information for compression. JSON |
|||
tags have been added for convenience. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Samples">type <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=926:947#L21">Samples</a></h2> |
|||
<pre>type Samples []<a href="index.html#Sample">Sample</a></pre> |
|||
<p> |
|||
Samples represents a slice of samples. It implements sort.Interface. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Samples.Len">func (Samples) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=949:975#L23">Len</a></h3> |
|||
<pre>func (a <a href="index.html#Samples">Samples</a>) Len() <a href="../../../../builtin/index.html#int">int</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Samples.Less">func (Samples) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=1004:1040#L24">Less</a></h3> |
|||
<pre>func (a <a href="index.html#Samples">Samples</a>) Less(i, j <a href="../../../../builtin/index.html#int">int</a>) <a href="../../../../builtin/index.html#bool">bool</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Samples.Swap">func (Samples) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=1076:1107#L25">Swap</a></h3> |
|||
<pre>func (a <a href="index.html#Samples">Samples</a>) Swap(i, j <a href="../../../../builtin/index.html#int">int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Stream">type <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=3472:3532#L91">Stream</a></h2> |
|||
<pre>type Stream struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Stream computes quantiles for a stream of float64s. It is not thread-safe by |
|||
design. Take care when using across multiple goroutines. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewHighBiased">func <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=2334:2377#L56">NewHighBiased</a></h3> |
|||
<pre>func NewHighBiased(epsilon <a href="../../../../builtin/index.html#float64">float64</a>) *<a href="index.html#Stream">Stream</a></pre> |
|||
<p> |
|||
NewHighBiased returns an initialized Stream for high-biased quantiles |
|||
(e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but |
|||
error guarantees can still be given even for the higher ranks of the data |
|||
distribution. |
|||
</p> |
|||
<p> |
|||
The provided epsilon is a relative error, i.e. the true quantile of a value |
|||
returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). |
|||
</p> |
|||
<p> |
|||
See <a href="http://www.cs.rutgers.edu/~muthu/bquant.pdf">http://www.cs.rutgers.edu/~muthu/bquant.pdf</a> for time, space, and error |
|||
properties. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewLowBiased">func <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=1688:1730#L39">NewLowBiased</a></h3> |
|||
<pre>func NewLowBiased(epsilon <a href="../../../../builtin/index.html#float64">float64</a>) *<a href="index.html#Stream">Stream</a></pre> |
|||
<p> |
|||
NewLowBiased returns an initialized Stream for low-biased quantiles |
|||
(e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but |
|||
error guarantees can still be given even for the lower ranks of the data |
|||
distribution. |
|||
</p> |
|||
<p> |
|||
The provided epsilon is a relative error, i.e. the true quantile of a value |
|||
returned by a query is guaranteed to be within (1±Epsilon)*Quantile. |
|||
</p> |
|||
<p> |
|||
See <a href="http://www.cs.rutgers.edu/~muthu/bquant.pdf">http://www.cs.rutgers.edu/~muthu/bquant.pdf</a> for time, space, and error |
|||
properties. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewTargeted">func <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=2944:2997#L70">NewTargeted</a></h3> |
|||
<pre>func NewTargeted(targets map[<a href="../../../../builtin/index.html#float64">float64</a>]<a href="../../../../builtin/index.html#float64">float64</a>) *<a href="index.html#Stream">Stream</a></pre> |
|||
<p> |
|||
NewTargeted returns an initialized Stream concerned with a particular set of |
|||
quantile values that are supplied a priori. Knowing these a priori reduces |
|||
space and computation time. The targets map maps the desired quantiles to |
|||
their absolute errors, i.e. the true quantile of a value returned by a query |
|||
is guaranteed to be within (Quantile±Epsilon). |
|||
</p> |
|||
<p> |
|||
See <a href="http://www.cs.rutgers.edu/~muthu/bquant.pdf">http://www.cs.rutgers.edu/~muthu/bquant.pdf</a> for time, space, and error properties. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Count">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=5246:5274#L164">Count</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Count() <a href="../../../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
Count returns the total number of samples observed in the stream |
|||
since initialization. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Insert">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=3683:3717#L103">Insert</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Insert(v <a href="../../../../builtin/index.html#float64">float64</a>)</pre> |
|||
<p> |
|||
Insert inserts v into the stream. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Merge">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=4764:4803#L142">Merge</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Merge(samples <a href="index.html#Samples">Samples</a>)</pre> |
|||
<p> |
|||
Merge merges samples into the underlying streams samples. This is handy when |
|||
merging multiple streams from separate threads, database shards, etc. |
|||
</p> |
|||
<p> |
|||
ATTENTION: This method is broken and does not yield correct results. The |
|||
underlying algorithm is not capable of merging streams correctly. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Query">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=4083:4124#L118">Query</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Query(q <a href="../../../../builtin/index.html#float64">float64</a>) <a href="../../../../builtin/index.html#float64">float64</a></pre> |
|||
<p> |
|||
Query returns the computed qth percentiles value. If s was created with |
|||
NewTargeted, and q is not in the set of quantiles provided a priori, Query |
|||
will return an unspecified result. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Reset">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=4932:4956#L148">Reset</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Reset()</pre> |
|||
<p> |
|||
Reset reinitializes and clears the list reusing the samples buffer memory. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Stream.Samples">func (*Stream) <a href="http://localhost:6060/src/github.com/beorn7/perks/quantile/stream.go?s=5040:5074#L154">Samples</a></h3> |
|||
<pre>func (s *<a href="index.html#Stream">Stream</a>) Samples() <a href="index.html#Samples">Samples</a></pre> |
|||
<p> |
|||
Samples returns stream samples held by s. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/bradfitz/gomemcache - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/bradfitz/gomemcache</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="memcache/index.html">memcache</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package memcache provides a client for the memcached cache server. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,699 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>memcache - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package memcache</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/bradfitz/gomemcache/memcache"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package memcache provides a client for the memcached cache server. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Client">type Client</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#New">func New(server ...string) *Client</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewFromSelector">func NewFromSelector(ss ServerSelector) *Client</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Add">func (c *Client) Add(item *Item) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.CompareAndSwap">func (c *Client) CompareAndSwap(item *Item) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Decrement">func (c *Client) Decrement(key string, delta uint64) (newValue uint64, err error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Delete">func (c *Client) Delete(key string) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.DeleteAll">func (c *Client) DeleteAll() error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.FlushAll">func (c *Client) FlushAll() error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Get">func (c *Client) Get(key string) (item *Item, err error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.GetMulti">func (c *Client) GetMulti(keys []string) (map[string]*Item, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Increment">func (c *Client) Increment(key string, delta uint64) (newValue uint64, err error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Replace">func (c *Client) Replace(item *Item) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Set">func (c *Client) Set(item *Item) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Client.Touch">func (c *Client) Touch(key string, seconds int32) (err error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ConnectTimeoutError">type ConnectTimeoutError</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ConnectTimeoutError.Error">func (cte *ConnectTimeoutError) Error() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Item">type Item</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ServerList">type ServerList</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ServerList.Each">func (ss *ServerList) Each(f func(net.Addr) error) error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ServerList.PickServer">func (ss *ServerList) PickServer(key string) (net.Addr, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ServerList.SetServers">func (ss *ServerList) SetServers(servers ...string) error</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ServerSelector">type ServerSelector</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go">memcache.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go">selector.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const <span id="DefaultTimeout">DefaultTimeout</span> = 100 * <a href="../../../../time/index.html">time</a>.<a href="../../../../time/index.html#Millisecond">Millisecond</a></pre> |
|||
<p> |
|||
DefaultTimeout is the default socket read/write timeout. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var ( |
|||
<span class="comment">// ErrCacheMiss means that a Get failed because the item wasn't present.</span> |
|||
<span id="ErrCacheMiss">ErrCacheMiss</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: cache miss") |
|||
|
|||
<span class="comment">// ErrCASConflict means that a CompareAndSwap call failed due to the</span> |
|||
<span class="comment">// cached value being modified between the Get and the CompareAndSwap.</span> |
|||
<span class="comment">// If the cached value was simply evicted rather than replaced,</span> |
|||
<span class="comment">// ErrNotStored will be returned instead.</span> |
|||
<span id="ErrCASConflict">ErrCASConflict</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: compare-and-swap conflict") |
|||
|
|||
<span class="comment">// ErrNotStored means that a conditional write operation (i.e. Add or</span> |
|||
<span class="comment">// CompareAndSwap) failed because the condition was not satisfied.</span> |
|||
<span id="ErrNotStored">ErrNotStored</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: item not stored") |
|||
|
|||
<span class="comment">// ErrServer means that a server error occurred.</span> |
|||
<span id="ErrServerError">ErrServerError</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: server error") |
|||
|
|||
<span class="comment">// ErrNoStats means that no statistics were available.</span> |
|||
<span id="ErrNoStats">ErrNoStats</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: no statistics available") |
|||
|
|||
<span class="comment">// ErrMalformedKey is returned when an invalid key is used.</span> |
|||
<span class="comment">// Keys must be at maximum 250 bytes long, ASCII, and not</span> |
|||
<span class="comment">// contain whitespace or control characters.</span> |
|||
<span id="ErrMalformedKey">ErrMalformedKey</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("malformed: key is too long or contains invalid characters") |
|||
|
|||
<span class="comment">// ErrNoServers is returned when no servers are configured or available.</span> |
|||
<span id="ErrNoServers">ErrNoServers</span> = <a href="../../../../errors/index.html">errors</a>.<a href="../../../../errors/index.html#New">New</a>("memcache: no servers configured or available") |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Client">type <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=4015:4227#L121">Client</a></h2> |
|||
<pre>type Client struct { |
|||
<span class="comment">// Timeout specifies the socket read/write timeout.</span> |
|||
<span class="comment">// If zero, DefaultTimeout is used.</span> |
|||
Timeout <a href="../../../../time/index.html">time</a>.<a href="../../../../time/index.html#Duration">Duration</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Client is a memcache client. |
|||
It is safe for unlocked use by multiple concurrent goroutines. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="New">func <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=3642:3676#L108">New</a></h3> |
|||
<pre>func New(server ...<a href="../../../../builtin/index.html#string">string</a>) *<a href="index.html#Client">Client</a></pre> |
|||
<p> |
|||
New returns a memcache client using the provided server(s) |
|||
with equal weight. If a server is listed multiple times, |
|||
it gets a proportional amount of weight. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewFromSelector">func <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=3834:3881#L115">NewFromSelector</a></h3> |
|||
<pre>func NewFromSelector(ss <a href="index.html#ServerSelector">ServerSelector</a>) *<a href="index.html#Client">Client</a></pre> |
|||
<p> |
|||
NewFromSelector returns a new Client using the provided ServerSelector. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Add">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=13419:13457#L495">Add</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Add(item *<a href="index.html#Item">Item</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Add writes the given item, if no value already exists for its |
|||
key. ErrNotStored is returned if that condition is not met. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.CompareAndSwap">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=14325:14374#L520">CompareAndSwap</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) CompareAndSwap(item *<a href="index.html#Item">Item</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
CompareAndSwap writes the given item that was previously returned |
|||
by Get, if the value was neither modified or evicted between the |
|||
Get and the CompareAndSwap calls. The item's Key should not change |
|||
between calls but all other item fields may differ. ErrCASConflict |
|||
is returned if the value was modified in between the |
|||
calls. ErrNotStored is returned if the value was evicted in between |
|||
the calls. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Decrement">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=17737:17818#L631">Decrement</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Decrement(key <a href="../../../../builtin/index.html#string">string</a>, delta <a href="../../../../builtin/index.html#uint64">uint64</a>) (newValue <a href="../../../../builtin/index.html#uint64">uint64</a>, err <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Decrement atomically decrements key by delta. The return value is |
|||
the new value after being decremented or an error. If the value |
|||
didn't exist in memcached the error is ErrCacheMiss. The value in |
|||
memcached must be an decimal number, or an error will be returned. |
|||
On underflow, the new value is capped at zero and does not wrap |
|||
around. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Delete">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=16552:16593#L603">Delete</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Delete(key <a href="../../../../builtin/index.html#string">string</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Delete deletes the item with the provided key. The error ErrCacheMiss is |
|||
returned if the item didn't already exist in the cache. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.DeleteAll">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=16771:16805#L610">DeleteAll</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) DeleteAll() <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
DeleteAll deletes all items in the cache. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.FlushAll">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=7611:7644#L283">FlushAll</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) FlushAll() <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Get">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=7834:7890#L289">Get</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Get(key <a href="../../../../builtin/index.html#string">string</a>) (item *<a href="index.html#Item">Item</a>, err <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Get gets the item for the given key. ErrCacheMiss is returned for a |
|||
memcache cache miss. The key must be at most 250 bytes in length. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.GetMulti">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=11104:11170#L403">GetMulti</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) GetMulti(keys []<a href="../../../../builtin/index.html#string">string</a>) (map[<a href="../../../../builtin/index.html#string">string</a>]*<a href="index.html#Item">Item</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
GetMulti is a batch version of Get. The returned map from keys to |
|||
items may have fewer elements than the input slice, due to memcache |
|||
cache misses. Each key must be at most 250 bytes in length. |
|||
If no error is returned, the returned map will also be non-nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Increment">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=17258:17339#L621">Increment</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Increment(key <a href="../../../../builtin/index.html#string">string</a>, delta <a href="../../../../builtin/index.html#uint64">uint64</a>) (newValue <a href="../../../../builtin/index.html#uint64">uint64</a>, err <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Increment atomically increments key by delta. The return value is |
|||
the new value after being incremented or an error. If the value |
|||
didn't exist in memcached the error is ErrCacheMiss. The value in |
|||
memcached must be an decimal number, or an error will be returned. |
|||
On 64-bit overflow, the new value wraps around. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Replace">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=13704:13746#L505">Replace</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Replace(item *<a href="index.html#Item">Item</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Replace writes the given item, but only if the server *does* |
|||
already hold data for this key |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Set">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=13104:13142#L485">Set</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Set(item *<a href="index.html#Item">Item</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Set writes the given item, unconditionally. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Client.Touch">func (*Client) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=8410:8471#L303">Touch</a></h3> |
|||
<pre>func (c *<a href="index.html#Client">Client</a>) Touch(key <a href="../../../../builtin/index.html#string">string</a>, seconds <a href="../../../../builtin/index.html#int32">int32</a>) (err <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Touch updates the expiry for the given key. The seconds parameter is either |
|||
a Unix timestamp or, if seconds is less than 1 month, the number of seconds |
|||
into the future at which time the item will expire. ErrCacheMiss is returned if the |
|||
key is not in the cache. The key must be at most 250 bytes in length. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConnectTimeoutError">type <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=6402:6452#L221">ConnectTimeoutError</a></h2> |
|||
<pre>type ConnectTimeoutError struct { |
|||
Addr <a href="../../../../net/index.html">net</a>.<a href="../../../../net/index.html#Addr">Addr</a> |
|||
}</pre> |
|||
<p> |
|||
ConnectTimeoutError is the error type used when it takes |
|||
too long to connect to the desired host. This level of |
|||
detail can generally be ignored. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ConnectTimeoutError.Error">func (*ConnectTimeoutError) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=6454:6500#L225">Error</a></h3> |
|||
<pre>func (cte *<a href="index.html#ConnectTimeoutError">ConnectTimeoutError</a>) Error() <a href="../../../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Item">type <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/memcache.go?s=4291:4762#L133">Item</a></h2> |
|||
<pre>type Item struct { |
|||
<span class="comment">// Key is the Item's key (250 bytes maximum).</span> |
|||
Key <a href="../../../../builtin/index.html#string">string</a> |
|||
|
|||
<span class="comment">// Value is the Item's value.</span> |
|||
Value []<a href="../../../../builtin/index.html#byte">byte</a> |
|||
|
|||
<span class="comment">// Flags are server-opaque flags whose semantics are entirely</span> |
|||
<span class="comment">// up to the app.</span> |
|||
Flags <a href="../../../../builtin/index.html#uint32">uint32</a> |
|||
|
|||
<span class="comment">// Expiration is the cache expiration time, in seconds: either a relative</span> |
|||
<span class="comment">// time from now (up to 1 month), or an absolute Unix epoch time.</span> |
|||
<span class="comment">// Zero means the Item has no expiration time.</span> |
|||
Expiration <a href="../../../../builtin/index.html#int32">int32</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Item is an item to be got or stored in a memcached server. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ServerList">type <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go?s=1098:1162#L29">ServerList</a></h2> |
|||
<pre>type ServerList struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
ServerList is a simple ServerSelector. Its zero value is usable. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ServerList.Each">func (*ServerList) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go?s=2129:2185#L68">Each</a></h3> |
|||
<pre>func (ss *<a href="index.html#ServerList">ServerList</a>) Each(f func(<a href="../../../../net/index.html">net</a>.<a href="../../../../net/index.html#Addr">Addr</a>) <a href="../../../../builtin/index.html#error">error</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Each iterates over each server calling the given function |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ServerList.PickServer">func (*ServerList) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go?s=2615:2677#L89">PickServer</a></h3> |
|||
<pre>func (ss *<a href="index.html#ServerList">ServerList</a>) PickServer(key <a href="../../../../builtin/index.html#string">string</a>) (<a href="../../../../net/index.html">net</a>.<a href="../../../../net/index.html#Addr">Addr</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ServerList.SetServers">func (*ServerList) <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go?s=1584:1641#L43">SetServers</a></h3> |
|||
<pre>func (ss *<a href="index.html#ServerList">ServerList</a>) SetServers(servers ...<a href="../../../../builtin/index.html#string">string</a>) <a href="../../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
SetServers changes a ServerList's set of servers at runtime and is |
|||
safe for concurrent use by multiple goroutines. |
|||
</p> |
|||
<p> |
|||
Each server is given equal weight. A server is given more weight |
|||
if it's listed multiple times. |
|||
</p> |
|||
<p> |
|||
SetServers returns an error if any of the server names fail to |
|||
resolve. No attempt is made to connect to the server. If any error |
|||
is returned, no changes are made to the ServerList. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ServerSelector">type <a href="http://localhost:6060/src/github.com/bradfitz/gomemcache/memcache/selector.go?s=832:1028#L21">ServerSelector</a></h2> |
|||
<pre>type ServerSelector interface { |
|||
<span class="comment">// PickServer returns the server address that a given item</span> |
|||
<span class="comment">// should be shared onto.</span> |
|||
PickServer(key <a href="../../../../builtin/index.html#string">string</a>) (<a href="../../../../net/index.html">net</a>.<a href="../../../../net/index.html#Addr">Addr</a>, <a href="../../../../builtin/index.html#error">error</a>) |
|||
Each(func(<a href="../../../../net/index.html">net</a>.<a href="../../../../net/index.html#Addr">Addr</a>) <a href="../../../../builtin/index.html#error">error</a>) <a href="../../../../builtin/index.html#error">error</a> |
|||
}</pre> |
|||
<p> |
|||
ServerSelector is the interface that selects a memcache server |
|||
as a function of the item's key. |
|||
</p> |
|||
<p> |
|||
All ServerSelector implementations must be safe for concurrent use |
|||
by multiple goroutines. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/bradfitz - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/bradfitz</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="gomemcache/index.html">gomemcache</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="gomemcache/memcache/index.html">memcache</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package memcache provides a client for the memcached cache server. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,872 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>backoff - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package backoff</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/cenkalti/backoff"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package backoff implements backoff algorithms for retrying operations. |
|||
</p> |
|||
<p> |
|||
Also has a Retry() helper for retrying operations that may fail. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Retry">func Retry(o Operation, b BackOff) error</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#RetryNotify">func RetryNotify(operation Operation, b BackOff, notify Notify) error</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#BackOff">type BackOff</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Clock">type Clock</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ConstantBackOff">type ConstantBackOff</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewConstantBackOff">func NewConstantBackOff(d time.Duration) *ConstantBackOff</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ConstantBackOff.NextBackOff">func (b *ConstantBackOff) NextBackOff() time.Duration</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ConstantBackOff.Reset">func (b *ConstantBackOff) Reset()</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ExponentialBackOff">type ExponentialBackOff</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewExponentialBackOff">func NewExponentialBackOff() *ExponentialBackOff</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ExponentialBackOff.GetElapsedTime">func (b *ExponentialBackOff) GetElapsedTime() time.Duration</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ExponentialBackOff.NextBackOff">func (b *ExponentialBackOff) NextBackOff() time.Duration</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ExponentialBackOff.Reset">func (b *ExponentialBackOff) Reset()</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Notify">type Notify</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Operation">type Operation</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#StopBackOff">type StopBackOff</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#StopBackOff.NextBackOff">func (b *StopBackOff) NextBackOff() time.Duration</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#StopBackOff.Reset">func (b *StopBackOff) Reset()</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Ticker">type Ticker</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewTicker">func NewTicker(b BackOff) *Ticker</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Ticker.Stop">func (t *Ticker) Stop()</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ZeroBackOff">type ZeroBackOff</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#ZeroBackOff.NextBackOff">func (b *ZeroBackOff) NextBackOff() time.Duration</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#ZeroBackOff.Reset">func (b *ZeroBackOff) Reset()</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_Retry">Retry</a></dd> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_Ticker">Ticker</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go">backoff.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go">exponential.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/cenkalti/backoff/retry.go">retry.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/cenkalti/backoff/ticker.go">ticker.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const ( |
|||
<span id="DefaultInitialInterval">DefaultInitialInterval</span> = 500 * <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Millisecond">Millisecond</a> |
|||
<span id="DefaultRandomizationFactor">DefaultRandomizationFactor</span> = 0.5 |
|||
<span id="DefaultMultiplier">DefaultMultiplier</span> = 1.5 |
|||
<span id="DefaultMaxInterval">DefaultMaxInterval</span> = 60 * <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Second">Second</a> |
|||
<span id="DefaultMaxElapsedTime">DefaultMaxElapsedTime</span> = 15 * <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Minute">Minute</a> |
|||
)</pre> |
|||
<p> |
|||
Default values for ExponentialBackOff. |
|||
</p> |
|||
|
|||
|
|||
<pre>const <span id="Stop">Stop</span> <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> = -1</pre> |
|||
<p> |
|||
Indicates that no more retries should be made for use in NextBackOff(). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="SystemClock">SystemClock</span> = systemClock{}</pre> |
|||
<p> |
|||
SystemClock implements Clock interface that uses time.Now(). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Retry">func <a href="http://localhost:6060/src/github.com/cenkalti/backoff/retry.go?s=767:807#L12">Retry</a></h2> |
|||
<pre>func Retry(o <a href="index.html#Operation">Operation</a>, b <a href="index.html#BackOff">BackOff</a>) <a href="../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Retry the operation o until it does not return error or BackOff stops. |
|||
o is guaranteed to be run at least once. |
|||
It is the caller's responsibility to reset b after Retry returns. |
|||
</p> |
|||
<p> |
|||
Retry sleeps the goroutine for the duration returned by BackOff after a |
|||
failed operation returns. |
|||
</p> |
|||
|
|||
<div id="example_Retry" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code"> |
|||
operation := func() error { |
|||
<span class="comment">// An operation that might fail.</span> |
|||
return nil <span class="comment">// or return errors.New("some error")</span> |
|||
} |
|||
|
|||
err := Retry(operation, NewExponentialBackOff()) |
|||
if err != nil { |
|||
<span class="comment">// Handle error.</span> |
|||
return err |
|||
} |
|||
|
|||
<span class="comment">// Operation is successful.</span> |
|||
return nil |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RetryNotify">func <a href="http://localhost:6060/src/github.com/cenkalti/backoff/retry.go?s=954:1023#L16">RetryNotify</a></h2> |
|||
<pre>func RetryNotify(operation <a href="index.html#Operation">Operation</a>, b <a href="index.html#BackOff">BackOff</a>, notify <a href="index.html#Notify">Notify</a>) <a href="../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
RetryNotify calls notify function with the error and wait duration |
|||
for each failed attempt before sleep. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="BackOff">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=235:684#L1">BackOff</a></h2> |
|||
<pre>type BackOff interface { |
|||
<span class="comment">// NextBackOff returns the duration to wait before retrying the operation,</span> |
|||
<span class="comment">// or backoff.Stop to indicate that no more retries should be made.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// Example usage:</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// duration := backoff.NextBackOff();</span> |
|||
<span class="comment">// if (duration == backoff.Stop) {</span> |
|||
<span class="comment">// // Do not retry operation.</span> |
|||
<span class="comment">// } else {</span> |
|||
<span class="comment">// // Sleep for duration and retry operation.</span> |
|||
<span class="comment">// }</span> |
|||
<span class="comment">//</span> |
|||
NextBackOff() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> |
|||
|
|||
<span class="comment">// Reset to initial state.</span> |
|||
Reset() |
|||
}</pre> |
|||
<p> |
|||
BackOff is a backoff policy for retrying an operation. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Clock">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=2287:2328#L59">Clock</a></h2> |
|||
<pre>type Clock interface { |
|||
Now() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a> |
|||
}</pre> |
|||
<p> |
|||
Clock is an interface that returns current time for BackOff. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ConstantBackOff">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1583:1638#L40">ConstantBackOff</a></h2> |
|||
<pre>type ConstantBackOff struct { |
|||
Interval <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> |
|||
}</pre> |
|||
<p> |
|||
ConstantBackOff is a backoff policy that always returns the same backoff delay. |
|||
This is in contrast to an exponential backoff policy, |
|||
which returns a delay that grows longer as you call NextBackOff() over and over again. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewConstantBackOff">func <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1774:1831#L47">NewConstantBackOff</a></h3> |
|||
<pre>func NewConstantBackOff(d <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a>) *<a href="index.html#ConstantBackOff">ConstantBackOff</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ConstantBackOff.NextBackOff">func (*ConstantBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1697:1750#L45">NextBackOff</a></h3> |
|||
<pre>func (b *<a href="index.html#ConstantBackOff">ConstantBackOff</a>) NextBackOff() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ConstantBackOff.Reset">func (*ConstantBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1640:1673#L44">Reset</a></h3> |
|||
<pre>func (b *<a href="index.html#ConstantBackOff">ConstantBackOff</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ExponentialBackOff">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=1850:2221#L44">ExponentialBackOff</a></h2> |
|||
<pre>type ExponentialBackOff struct { |
|||
InitialInterval <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> |
|||
RandomizationFactor <a href="../../../builtin/index.html#float64">float64</a> |
|||
Multiplier <a href="../../../builtin/index.html#float64">float64</a> |
|||
MaxInterval <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> |
|||
<span class="comment">// After MaxElapsedTime the ExponentialBackOff stops.</span> |
|||
<span class="comment">// It never stops if MaxElapsedTime == 0.</span> |
|||
MaxElapsedTime <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a> |
|||
Clock <a href="index.html#Clock">Clock</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
ExponentialBackOff is a backoff implementation that increases the backoff |
|||
period for each retry attempt using a randomization function that grows exponentially. |
|||
</p> |
|||
<p> |
|||
NextBackOff() is calculated using the following formula: |
|||
</p> |
|||
<pre>randomized interval = |
|||
RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) |
|||
</pre> |
|||
<p> |
|||
In other words NextBackOff() will range between the randomization factor |
|||
percentage below and above the retry interval. |
|||
</p> |
|||
<p> |
|||
For example, given the following parameters: |
|||
</p> |
|||
<pre>RetryInterval = 2 |
|||
RandomizationFactor = 0.5 |
|||
Multiplier = 2 |
|||
</pre> |
|||
<p> |
|||
the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, |
|||
multiplied by the exponential, that is, between 2 and 6 seconds. |
|||
</p> |
|||
<p> |
|||
Note: MaxInterval caps the RetryInterval and not the randomized interval. |
|||
</p> |
|||
<p> |
|||
If the time elapsed since an ExponentialBackOff instance is created goes past the |
|||
MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop. |
|||
</p> |
|||
<p> |
|||
The elapsed time can be reset by calling Reset(). |
|||
</p> |
|||
<p> |
|||
Example: Given the following default arguments, for 10 tries the sequence will be, |
|||
and assuming we go over the MaxElapsedTime on the 10th try: |
|||
</p> |
|||
<pre>Request # RetryInterval (seconds) Randomized Interval (seconds) |
|||
|
|||
1 0.5 [0.25, 0.75] |
|||
2 0.75 [0.375, 1.125] |
|||
3 1.125 [0.562, 1.687] |
|||
4 1.687 [0.8435, 2.53] |
|||
5 2.53 [1.265, 3.795] |
|||
6 3.795 [1.897, 5.692] |
|||
7 5.692 [2.846, 8.538] |
|||
8 8.538 [4.269, 12.807] |
|||
9 12.807 [6.403, 19.210] |
|||
10 19.210 backoff.Stop |
|||
</pre> |
|||
<p> |
|||
Note: Implementation is not thread-safe. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewExponentialBackOff">func <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=2687:2735#L73">NewExponentialBackOff</a></h3> |
|||
<pre>func NewExponentialBackOff() *<a href="index.html#ExponentialBackOff">ExponentialBackOff</a></pre> |
|||
<p> |
|||
NewExponentialBackOff creates an instance of ExponentialBackOff using default values. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ExponentialBackOff.GetElapsedTime">func (*ExponentialBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=4250:4309#L121">GetElapsedTime</a></h3> |
|||
<pre>func (b *<a href="index.html#ExponentialBackOff">ExponentialBackOff</a>) GetElapsedTime() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a></pre> |
|||
<p> |
|||
GetElapsedTime returns the elapsed time since an ExponentialBackOff instance |
|||
is created and is reset when Reset() is called. |
|||
</p> |
|||
<p> |
|||
The elapsed time is computed using time.Now().UnixNano(). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ExponentialBackOff.NextBackOff">func (*ExponentialBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=3716:3772#L108">NextBackOff</a></h3> |
|||
<pre>func (b *<a href="index.html#ExponentialBackOff">ExponentialBackOff</a>) NextBackOff() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a></pre> |
|||
<p> |
|||
NextBackOff calculates the next backoff interval using the formula: |
|||
</p> |
|||
<pre>Randomized interval = RetryInterval +/- (RandomizationFactor * RetryInterval) |
|||
</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ExponentialBackOff.Reset">func (*ExponentialBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/exponential.go?s=3453:3489#L101">Reset</a></h3> |
|||
<pre>func (b *<a href="index.html#ExponentialBackOff">ExponentialBackOff</a>) Reset()</pre> |
|||
<p> |
|||
Reset the interval back to the initial retry interval and restarts the timer. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Notify">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/retry.go?s=433:471#L4">Notify</a></h2> |
|||
<pre>type Notify func(<a href="../../../builtin/index.html#error">error</a>, <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a>)</pre> |
|||
<p> |
|||
Notify is a notify-on-error function. It receives an operation error and |
|||
backoff delay if the operation failed (with an error). |
|||
</p> |
|||
<p> |
|||
NOTE that if the backoff policy stated to stop retrying, |
|||
the notify function isn't called. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Operation">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/retry.go?s=170:197#L1">Operation</a></h2> |
|||
<pre>type Operation func() <a href="../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
An Operation is executing by Retry() or RetryNotify(). |
|||
The operation will be retried using a backoff policy if it returns an error. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="StopBackOff">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1225:1250#L31">StopBackOff</a></h2> |
|||
<pre>type StopBackOff struct{}</pre> |
|||
<p> |
|||
StopBackOff is a fixed backoff policy that always returns backoff.Stop for |
|||
NextBackOff(), meaning that the operation should never be retried. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="StopBackOff.NextBackOff">func (*StopBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1286:1335#L35">NextBackOff</a></h3> |
|||
<pre>func (b *<a href="index.html#StopBackOff">StopBackOff</a>) NextBackOff() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="StopBackOff.Reset">func (*StopBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1252:1281#L33">Reset</a></h3> |
|||
<pre>func (b *<a href="index.html#StopBackOff">StopBackOff</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Ticker">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/ticker.go?s=303:439#L3">Ticker</a></h2> |
|||
<pre>type Ticker struct { |
|||
C <-chan <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Time">Time</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. |
|||
</p> |
|||
<p> |
|||
Ticks will continue to arrive when the previous operation is still running, |
|||
so operations that take a while to fail could run in quick succession. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="example_Ticker" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code"> |
|||
operation := func() error { |
|||
<span class="comment">// An operation that might fail</span> |
|||
return nil <span class="comment">// or return errors.New("some error")</span> |
|||
} |
|||
|
|||
b := NewExponentialBackOff() |
|||
ticker := NewTicker(b) |
|||
|
|||
var err error |
|||
|
|||
<span class="comment">// Ticks will continue to arrive when the previous operation is still running,</span> |
|||
<span class="comment">// so operations that take a while to fail could run in quick succession.</span> |
|||
for _ = range ticker.C { |
|||
if err = operation(); err != nil { |
|||
log.Println(err, "will retry...") |
|||
continue |
|||
} |
|||
|
|||
ticker.Stop() |
|||
break |
|||
} |
|||
|
|||
if err != nil { |
|||
<span class="comment">// Operation has failed.</span> |
|||
return err |
|||
} |
|||
|
|||
<span class="comment">// Operation is successful.</span> |
|||
return nil |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewTicker">func <a href="http://localhost:6060/src/github.com/cenkalti/backoff/ticker.go?s=681:714#L14">NewTicker</a></h3> |
|||
<pre>func NewTicker(b <a href="index.html#BackOff">BackOff</a>) *<a href="index.html#Ticker">Ticker</a></pre> |
|||
<p> |
|||
NewTicker returns a new Ticker containing a channel that will send the time at times |
|||
specified by the BackOff argument. Ticker is guaranteed to tick at least once. |
|||
The channel is closed when Stop method is called or BackOff stops. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Ticker.Stop">func (*Ticker) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/ticker.go?s=958:981#L28">Stop</a></h3> |
|||
<pre>func (t *<a href="index.html#Ticker">Ticker</a>) Stop()</pre> |
|||
<p> |
|||
Stop turns off a ticker. After Stop, no more ticks will be sent. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ZeroBackOff">type <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=952:977#L23">ZeroBackOff</a></h2> |
|||
<pre>type ZeroBackOff struct{}</pre> |
|||
<p> |
|||
ZeroBackOff is a fixed backoff policy whose backoff time is always zero, |
|||
meaning that the operation is retried immediately without waiting, indefinitely. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ZeroBackOff.NextBackOff">func (*ZeroBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=1013:1062#L27">NextBackOff</a></h3> |
|||
<pre>func (b *<a href="index.html#ZeroBackOff">ZeroBackOff</a>) NextBackOff() <a href="../../../time/index.html">time</a>.<a href="../../../time/index.html#Duration">Duration</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="ZeroBackOff.Reset">func (*ZeroBackOff) <a href="http://localhost:6060/src/github.com/cenkalti/backoff/backoff.go?s=979:1008#L25">Reset</a></h3> |
|||
<pre>func (b *<a href="index.html#ZeroBackOff">ZeroBackOff</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/cenkalti - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/cenkalti</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="backoff/index.html">backoff</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package backoff implements backoff algorithms for retrying operations. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
1424
pkg/github.com/codegangsta/cli/altsrc/index.html
File diff suppressed because it is too large
View File
3602
pkg/github.com/codegangsta/cli/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/codegangsta - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/codegangsta</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="cli/index.html">cli</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package cli provides a minimal framework for creating and organizing command line Go applications. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="cli/altsrc/index.html">altsrc</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/dghubble/go-twitter - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/dghubble/go-twitter</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="twitter/index.html">twitter</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twitter provides a Client for the Twitter API. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
3028
pkg/github.com/dghubble/go-twitter/twitter/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,218 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/dghubble - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/dghubble</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="go-twitter/index.html">go-twitter</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="go-twitter/twitter/index.html">twitter</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twitter provides a Client for the Twitter API. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="oauth1/index.html">oauth1</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package oauth1 is a Go implementation of the OAuth1 spec RFC 5849. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="oauth1/dropbox/index.html">dropbox</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package dropbox provides constants for using OAuth1 to access Dropbox. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="oauth1/examples/index.html">examples</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="oauth1/tumblr/index.html">tumblr</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package tumblr provides constants for using OAuth 1 to access Tumblr. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="oauth1/twitter/index.html">twitter</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twitter provides constants for using OAuth1 to access Twitter. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="sling/index.html">sling</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package sling is a Go HTTP client library for creating and sending API requests. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="sling/examples/index.html">examples</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,220 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>dropbox - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package dropbox</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/dghubble/oauth1/dropbox"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package dropbox provides constants for using OAuth1 to access Dropbox. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/dropbox/dropbox.go">dropbox.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="Endpoint">Endpoint</span> = <a href="../index.html">oauth1</a>.<a href="../index.html#Endpoint">Endpoint</a>{ |
|||
<a href="index.html#RequestTokenURL">RequestTokenURL</a>: "https://api.dropbox.com/1/oauth/request_token", |
|||
<a href="index.html#AuthorizeURL">AuthorizeURL</a>: "https://api.dropbox.com/1/oauth/authorize", |
|||
<a href="index.html#AccessTokenURL">AccessTokenURL</a>: "https://api.dropbox.com/1/oauth/access_token", |
|||
}</pre> |
|||
<p> |
|||
Endpoint is Dropbox's OAuth 1 endpoint. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,106 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>examples - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Command examples</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,902 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>oauth1 - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package oauth1</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/dghubble/oauth1"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package oauth1 is a Go implementation of the OAuth1 spec RFC 5849. |
|||
</p> |
|||
<p> |
|||
It allows end-users to authorize a client (consumer) to access protected |
|||
resources on their behalf (e.g. login) and allows clients to make signed and |
|||
authorized requests on behalf of a user (e.g. API calls). |
|||
</p> |
|||
<p> |
|||
It takes design cues from golang.org/x/oauth2, providing an http.Client which |
|||
handles request signing and authorization. |
|||
</p> |
|||
<h3 id="hdr-Usage">Usage</h3> |
|||
<p> |
|||
Package oauth1 implements the OAuth1 authorization flow and provides an |
|||
http.Client which can sign and authorize OAuth1 requests. |
|||
</p> |
|||
<p> |
|||
To implement "Login with X", use the <a href="https://github.com/dghubble/gologin">https://github.com/dghubble/gologin</a> |
|||
packages which provide login handlers for OAuth1 and OAuth2 providers. |
|||
</p> |
|||
<p> |
|||
To call the Twitter, Digits, or Tumblr OAuth1 APIs, use the higher level Go API |
|||
clients. |
|||
</p> |
|||
<p> |
|||
* <a href="https://github.com/dghubble/go-twitter">https://github.com/dghubble/go-twitter</a> |
|||
* <a href="https://github.com/dghubble/go-digits">https://github.com/dghubble/go-digits</a> |
|||
* <a href="https://github.com/benfb/go-tumblr">https://github.com/benfb/go-tumblr</a> |
|||
</p> |
|||
<h3 id="hdr-Authorization_Flow">Authorization Flow</h3> |
|||
<p> |
|||
Perform the OAuth 1 authorization flow to ask a user to grant an application |
|||
access to his/her resources via an access token. |
|||
</p> |
|||
<pre>import ( |
|||
"github.com/dghubble/oauth1" |
|||
"github.com/dghubble/oauth1/twitter"" |
|||
) |
|||
... |
|||
|
|||
config := oauth1.Config{ |
|||
ConsumerKey: "consumerKey", |
|||
ConsumerSecret: "consumerSecret", |
|||
CallbackURL: "<a href="http://mysite.com/oauth/twitter/callback">http://mysite.com/oauth/twitter/callback</a>", |
|||
Endpoint: twitter.AuthorizeEndpoint, |
|||
} |
|||
</pre> |
|||
<p> |
|||
1. When a user performs an action (e.g. "Login with X" button calls "/login" |
|||
route) get an OAuth1 request token (temporary credentials). |
|||
</p> |
|||
<pre>requestToken, requestSecret, err = config.RequestToken() |
|||
// handle err |
|||
</pre> |
|||
<p> |
|||
2. Obtain authorization from the user by redirecting them to the OAuth1 |
|||
provider's authorization URL to grant the application access. |
|||
</p> |
|||
<pre>authorizationURL, err := config.AuthorizationURL(requestToken) |
|||
// handle err |
|||
http.Redirect(w, req, authorizationURL.String(), htt.StatusFound) |
|||
</pre> |
|||
<p> |
|||
Receive the callback from the OAuth1 provider in a handler. |
|||
</p> |
|||
<pre>requestToken, verifier, err := oauth1.ParseAuthorizationCallback(req) |
|||
// handle err |
|||
</pre> |
|||
<p> |
|||
3. Acquire the access token (token credentials) which can later be used |
|||
to make requests on behalf of the user. |
|||
</p> |
|||
<pre>accessToken, accessSecret, err := config.AccessToken(requestToken, requestSecret, verifier) |
|||
// handle error |
|||
token := NewToken(accessToken, accessSecret) |
|||
</pre> |
|||
<p> |
|||
Check the examples to see this authorization flow in action from the command |
|||
line, with Twitter PIN-based login and Tumblr login. |
|||
</p> |
|||
<h3 id="hdr-Authorized_Requests">Authorized Requests</h3> |
|||
<p> |
|||
Use an access Token to make authorized requests on behalf of a user. |
|||
</p> |
|||
<pre>import ( |
|||
"github.com/dghubble/oauth1" |
|||
) |
|||
|
|||
func main() { |
|||
config := oauth1.NewConfig("consumerKey", "consumerSecret") |
|||
token := oauth1.NewToken("token", "tokenSecret") |
|||
|
|||
// httpClient will automatically authorize http.Request's |
|||
httpClient := config.Client(token) |
|||
|
|||
// example Twitter API request |
|||
path := "<a href="https://api.twitter.com/1.1/statuses/home_timeline.json?count=2">https://api.twitter.com/1.1/statuses/home_timeline.json?count=2</a>" |
|||
resp, _ := httpClient.Get(path) |
|||
defer resp.Body.Close() |
|||
body, _ := ioutil.ReadAll(resp.Body) |
|||
fmt.Printf("Raw Response Body:\n%v\n", string(body)) |
|||
} |
|||
</pre> |
|||
<p> |
|||
Check the examples to see Twitter and Tumblr requests in action. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#NewClient">func NewClient(ctx context.Context, config *Config, token *Token) *http.Client</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#ParseAuthorizationCallback">func ParseAuthorizationCallback(req *http.Request) (requestToken, verifier string, err error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#PercentEncode">func PercentEncode(input string) string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Config">type Config</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewConfig">func NewConfig(consumerKey, consumerSecret string) *Config</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Config.AccessToken">func (c *Config) AccessToken(requestToken, requestSecret, verifier string) (accessToken, accessSecret string, err error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Config.AuthorizationURL">func (c *Config) AuthorizationURL(requestToken string) (*url.URL, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Config.Client">func (c *Config) Client(ctx context.Context, t *Token) *http.Client</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Config.RequestToken">func (c *Config) RequestToken() (requestToken, requestSecret string, err error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Endpoint">type Endpoint</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#HMACSigner">type HMACSigner</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#HMACSigner.Name">func (s *HMACSigner) Name() string</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#HMACSigner.Sign">func (s *HMACSigner) Sign(tokenSecret, message string) (string, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#RSASigner">type RSASigner</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#RSASigner.Name">func (s *RSASigner) Name() string</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#RSASigner.Sign">func (s *RSASigner) Sign(tokenSecret, message string) (string, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Signer">type Signer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Token">type Token</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewToken">func NewToken(token, tokenSecret string) *Token</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#TokenSource">type TokenSource</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#StaticTokenSource">func StaticTokenSource(token *Token) TokenSource</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Transport">type Transport</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Transport.RoundTrip">func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/auther.go">auther.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go">config.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/context.go">context.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/doc.go">doc.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/encode.go">encode.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/endpoint.go">endpoint.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go">signer.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/token.go">token.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/transport.go">transport.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="HTTPClient">HTTPClient</span> contextKey</pre> |
|||
<p> |
|||
HTTPClient is the context key to associate an *http.Client value with |
|||
a context. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="NoContext">NoContext</span> = <a href="../../../golang.org/x/net/context/index.html">context</a>.<a href="../../../golang.org/x/net/context/index.html#TODO">TODO</a>()</pre> |
|||
<p> |
|||
NoContext is the default context to use in most cases. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="NewClient">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=1165:1243#L36">NewClient</a></h2> |
|||
<pre>func NewClient(ctx <a href="../../../golang.org/x/net/context/index.html">context</a>.<a href="../../../golang.org/x/net/context/index.html#Context">Context</a>, config *<a href="index.html#Config">Config</a>, token *<a href="index.html#Token">Token</a>) *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Client">Client</a></pre> |
|||
<p> |
|||
NewClient returns a new http Client which signs requests via OAuth1. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ParseAuthorizationCallback">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=3797:3890#L106">ParseAuthorizationCallback</a></h2> |
|||
<pre>func ParseAuthorizationCallback(req *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Request">Request</a>) (requestToken, verifier <a href="../../../builtin/index.html#string">string</a>, err <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
ParseAuthorizationCallback parses an OAuth1 authorization callback request |
|||
from a provider server. The oauth_token and oauth_verifier parameters are |
|||
parsed to return the request token from earlier in the flow and the |
|||
verifier string. |
|||
See RFC 5849 2.2 Resource Owner Authorization. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="PercentEncode">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/encode.go?s=113:152#L1">PercentEncode</a></h2> |
|||
<pre>func PercentEncode(input <a href="../../../builtin/index.html#string">string</a>) <a href="../../../builtin/index.html#string">string</a></pre> |
|||
<p> |
|||
PercentEncode percent encodes a string according to RFC 3986 2.1. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Config">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=375:687#L9">Config</a></h2> |
|||
<pre>type Config struct { |
|||
<span class="comment">// Consumer Key (Client Identifier)</span> |
|||
ConsumerKey <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Consumer Secret (Client Shared-Secret)</span> |
|||
ConsumerSecret <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Callback URL</span> |
|||
CallbackURL <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Provider Endpoint specifying OAuth1 endpoint URLs</span> |
|||
Endpoint <a href="index.html#Endpoint">Endpoint</a> |
|||
<span class="comment">// OAuth1 Signer (defaults to HMAC-SHA1)</span> |
|||
Signer <a href="index.html#Signer">Signer</a> |
|||
}</pre> |
|||
<p> |
|||
Config represents an OAuth1 consumer's (client's) key and secret, the |
|||
callback URL, and the provider Endpoint to which the consumer corresponds. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewConfig">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=763:821#L23">NewConfig</a></h3> |
|||
<pre>func NewConfig(consumerKey, consumerSecret <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Config">Config</a></pre> |
|||
<p> |
|||
NewConfig returns a new Config with the given consumer key and secret. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Config.AccessToken">func (*Config) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=4542:4662#L125">AccessToken</a></h3> |
|||
<pre>func (c *<a href="index.html#Config">Config</a>) AccessToken(requestToken, requestSecret, verifier <a href="../../../builtin/index.html#string">string</a>) (accessToken, accessSecret <a href="../../../builtin/index.html#string">string</a>, err <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
AccessToken obtains an access token (token credential) by POSTing a |
|||
request (with oauth_token and oauth_verifier in the auth header) to the |
|||
Endpoint AccessTokenURL. Returns the access token and secret (token |
|||
credentials). |
|||
See RFC 5849 2.3 Token Credentials. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Config.AuthorizationURL">func (*Config) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=3170:3242#L90">AuthorizationURL</a></h3> |
|||
<pre>func (c *<a href="index.html#Config">Config</a>) AuthorizationURL(requestToken <a href="../../../builtin/index.html#string">string</a>) (*<a href="../../../net/url/index.html">url</a>.<a href="../../../net/url/index.html#URL">URL</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
AuthorizationURL accepts a request token and returns the *url.URL to the |
|||
Endpoint's authorization page that asks the user (resource owner) for to |
|||
authorize the consumer to act on his/her/its behalf. |
|||
See RFC 5849 2.2 Resource Owner Authorization. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Config.Client">func (*Config) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=991:1058#L31">Client</a></h3> |
|||
<pre>func (c *<a href="index.html#Config">Config</a>) Client(ctx <a href="../../../golang.org/x/net/context/index.html">context</a>.<a href="../../../golang.org/x/net/context/index.html#Context">Context</a>, t *<a href="index.html#Token">Token</a>) *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Client">Client</a></pre> |
|||
<p> |
|||
Client returns an HTTP client which uses the provided ctx and access Token. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Config.RequestToken">func (*Config) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/config.go?s=1785:1864#L51">RequestToken</a></h3> |
|||
<pre>func (c *<a href="index.html#Config">Config</a>) RequestToken() (requestToken, requestSecret <a href="../../../builtin/index.html#string">string</a>, err <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
RequestToken obtains a Request token and secret (temporary credential) by |
|||
POSTing a request (with oauth_callback in the auth header) to the Endpoint |
|||
RequestTokenURL. The response body form is validated to ensure |
|||
oauth_callback_confirmed is true. Returns the request token and secret |
|||
(temporary credentials). |
|||
See RFC 5849 2.1 Temporary Credentials. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Endpoint">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/endpoint.go?s=141:378#L1">Endpoint</a></h2> |
|||
<pre>type Endpoint struct { |
|||
<span class="comment">// Request URL (Temporary Credential Request URI)</span> |
|||
RequestTokenURL <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Authorize URL (Resource Owner Authorization URI)</span> |
|||
AuthorizeURL <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Access Token URL (Token Request URI)</span> |
|||
AccessTokenURL <a href="../../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
Endpoint represents an OAuth1 provider's (server's) request token, |
|||
owner authorization, and access token request URLs. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="HMACSigner">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=510:559#L13">HMACSigner</a></h2> |
|||
<pre>type HMACSigner struct { |
|||
ConsumerSecret <a href="../../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
HMACSigner signs messages with an HMAC SHA1 digest, using the concatenated |
|||
consumer secret and token secret as the key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="HMACSigner.Name">func (*HMACSigner) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=599:633#L18">Name</a></h3> |
|||
<pre>func (s *<a href="index.html#HMACSigner">HMACSigner</a>) Name() <a href="../../../builtin/index.html#string">string</a></pre> |
|||
<p> |
|||
Name returns the HMAC-SHA1 method. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="HMACSigner.Sign">func (*HMACSigner) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=811:881#L24">Sign</a></h3> |
|||
<pre>func (s *<a href="index.html#HMACSigner">HMACSigner</a>) Sign(tokenSecret, message <a href="../../../builtin/index.html#string">string</a>) (<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Sign creates a concatenated consumer and token secret key and calculates |
|||
the HMAC digest of the message. Returns the base64 encoded digest bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="RSASigner">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=1226:1279#L34">RSASigner</a></h2> |
|||
<pre>type RSASigner struct { |
|||
PrivateKey *<a href="../../../crypto/rsa/index.html">rsa</a>.<a href="../../../crypto/rsa/index.html#PrivateKey">PrivateKey</a> |
|||
}</pre> |
|||
<p> |
|||
RSASigner RSA PKCS1-v1_5 signs SHA1 digests of messages using the given |
|||
RSA private key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="RSASigner.Name">func (*RSASigner) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=1318:1351#L39">Name</a></h3> |
|||
<pre>func (s *<a href="index.html#RSASigner">RSASigner</a>) Name() <a href="../../../builtin/index.html#string">string</a></pre> |
|||
<p> |
|||
Name returns the RSA-SHA1 method. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="RSASigner.Sign">func (*RSASigner) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=1505:1574#L45">Sign</a></h3> |
|||
<pre>func (s *<a href="index.html#RSASigner">RSASigner</a>) Sign(tokenSecret, message <a href="../../../builtin/index.html#string">string</a>) (<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Sign uses RSA PKCS1-v1_5 to sign a SHA1 digest of the given message. The |
|||
tokenSecret is not used with this signing scheme. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Signer">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/signer.go?s=188:382#L4">Signer</a></h2> |
|||
<pre>type Signer interface { |
|||
<span class="comment">// Name returns the name of the signing method.</span> |
|||
Name() <a href="../../../builtin/index.html#string">string</a> |
|||
<span class="comment">// Sign signs the message using the given secret key.</span> |
|||
Sign(key <a href="../../../builtin/index.html#string">string</a>, message <a href="../../../builtin/index.html#string">string</a>) (<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
A Signer signs messages to create signed OAuth1 Requests. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Token">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/token.go?s=266:327#L4">Token</a></h2> |
|||
<pre>type Token struct { |
|||
Token <a href="../../../builtin/index.html#string">string</a> |
|||
TokenSecret <a href="../../../builtin/index.html#string">string</a> |
|||
}</pre> |
|||
<p> |
|||
Token is an AccessToken (token credential) which allows a consumer (client) |
|||
to access resources from an OAuth1 provider server. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewToken">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/token.go?s=400:447#L10">NewToken</a></h3> |
|||
<pre>func NewToken(token, tokenSecret <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Token">Token</a></pre> |
|||
<p> |
|||
NewToken returns a new Token with the given token and token secret. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="TokenSource">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/token.go?s=75:130#L1">TokenSource</a></h2> |
|||
<pre>type TokenSource interface { |
|||
Token() (*<a href="index.html#Token">Token</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
A TokenSource can return a Token. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="StaticTokenSource">func <a href="http://localhost:6060/src/github.com/dghubble/oauth1/token.go?s=673:721#L19">StaticTokenSource</a></h3> |
|||
<pre>func StaticTokenSource(token *<a href="index.html#Token">Token</a>) <a href="index.html#TokenSource">TokenSource</a></pre> |
|||
<p> |
|||
StaticTokenSource returns a TokenSource which always returns the same Token. |
|||
This is appropriate for tokens which do not have a time expiration. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Transport">type <a href="http://localhost:6060/src/github.com/dghubble/oauth1/transport.go?s=330:641#L4">Transport</a></h2> |
|||
<pre>type Transport struct { |
|||
<span class="comment">// Base is the base RoundTripper used to make HTTP requests. If nil, then</span> |
|||
<span class="comment">// http.DefaultTransport is used</span> |
|||
Base <a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#RoundTripper">RoundTripper</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Transport is an http.RoundTripper which makes OAuth1 HTTP requests. It |
|||
wraps a base RoundTripper and adds an Authorization header using the |
|||
token from a TokenSource. |
|||
</p> |
|||
<p> |
|||
Transport is a low-level component, most users should use Config to create |
|||
an http.Client instead. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Transport.RoundTrip">func (*Transport) <a href="http://localhost:6060/src/github.com/dghubble/oauth1/transport.go?s=758:830#L16">RoundTrip</a></h3> |
|||
<pre>func (t *<a href="index.html#Transport">Transport</a>) RoundTrip(req *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Request">Request</a>) (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Response">Response</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
RoundTrip authorizes the request with a signed OAuth1 Authorization header |
|||
using the auther and TokenSource. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-subdirectories">Subdirectories</h2> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="dropbox/index.html">dropbox</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package dropbox provides constants for using OAuth1 to access Dropbox. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="examples/index.html">examples</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="tumblr/index.html">tumblr</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package tumblr provides constants for using OAuth 1 to access Tumblr. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="twitter/index.html">twitter</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twitter provides constants for using OAuth1 to access Twitter. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,220 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>tumblr - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package tumblr</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/dghubble/oauth1/tumblr"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package tumblr provides constants for using OAuth 1 to access Tumblr. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/tumblr/tumblr.go">tumblr.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="Endpoint">Endpoint</span> = <a href="../index.html">oauth1</a>.<a href="../index.html#Endpoint">Endpoint</a>{ |
|||
<a href="index.html#RequestTokenURL">RequestTokenURL</a>: "http://www.tumblr.com/oauth/request_token", |
|||
<a href="index.html#AuthorizeURL">AuthorizeURL</a>: "http://www.tumblr.com/oauth/authorize", |
|||
<a href="index.html#AccessTokenURL">AccessTokenURL</a>: "http://www.tumblr.com/oauth/access_token", |
|||
}</pre> |
|||
<p> |
|||
Endpoint is Tumblr's OAuth 1a endpoint. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,235 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>twitter - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package twitter</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/dghubble/oauth1/twitter"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package twitter provides constants for using OAuth1 to access Twitter. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/oauth1/twitter/twitter.go">twitter.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="AuthenticateEndpoint">AuthenticateEndpoint</span> = <a href="../index.html">oauth1</a>.<a href="../index.html#Endpoint">Endpoint</a>{ |
|||
<a href="index.html#RequestTokenURL">RequestTokenURL</a>: "https://api.twitter.com/oauth/request_token", |
|||
<a href="index.html#AuthorizeURL">AuthorizeURL</a>: "https://api.twitter.com/oauth/authenticate", |
|||
<a href="index.html#AccessTokenURL">AccessTokenURL</a>: "https://api.twitter.com/oauth/access_token", |
|||
}</pre> |
|||
<p> |
|||
AuthenticateEndpoint is Twitter's OAuth 1 endpoint which uses the |
|||
oauth/authenticate AuthorizeURL redirect. Logged in users who have granted |
|||
access are immediately authenticated and redirected to the callback URL. |
|||
</p> |
|||
|
|||
|
|||
<pre>var <span id="AuthorizeEndpoint">AuthorizeEndpoint</span> = <a href="../index.html">oauth1</a>.<a href="../index.html#Endpoint">Endpoint</a>{ |
|||
<a href="index.html#RequestTokenURL">RequestTokenURL</a>: "https://api.twitter.com/oauth/request_token", |
|||
<a href="index.html#AuthorizeURL">AuthorizeURL</a>: "https://api.twitter.com/oauth/authorize", |
|||
<a href="index.html#AccessTokenURL">AccessTokenURL</a>: "https://api.twitter.com/oauth/access_token", |
|||
}</pre> |
|||
<p> |
|||
AuthorizeEndpoint is Twitter's OAuth 1 endpoint which uses the |
|||
oauth/authorize AuthorizeURL redirect. Note that this requires users who |
|||
have granted access previously, to re-grant access at AuthorizeURL. |
|||
Prefer AuthenticateEndpoint over AuthorizeEndpoint if you are unsure. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,106 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>examples - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Command examples</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,858 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>sling - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package sling</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/dghubble/sling"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package sling is a Go HTTP client library for creating and sending API requests. |
|||
</p> |
|||
<p> |
|||
Slings store HTTP Request properties to simplify sending requests and decoding |
|||
responses. Check the examples to learn how to compose a Sling into your API |
|||
client. |
|||
</p> |
|||
<h3 id="hdr-Usage">Usage</h3> |
|||
<p> |
|||
Use a Sling to set path, method, header, query, or body properties and create an |
|||
http.Request. |
|||
</p> |
|||
<pre>type Params struct { |
|||
Count int `url:"count,omitempty"` |
|||
} |
|||
params := &Params{Count: 5} |
|||
|
|||
req, err := sling.New().Get("<a href="https://example.com">https://example.com</a>").QueryStruct(params).Request() |
|||
client.Do(req) |
|||
</pre> |
|||
<h3 id="hdr-Path">Path</h3> |
|||
<p> |
|||
Use Path to set or extend the URL for created Requests. Extension means the |
|||
path will be resolved relative to the existing URL. |
|||
</p> |
|||
<pre>// creates a GET request to <a href="https://example.com/foo/bar">https://example.com/foo/bar</a> |
|||
req, err := sling.New().Base("<a href="https://example.com/">https://example.com/</a>").Path("foo/").Path("bar").Request() |
|||
</pre> |
|||
<p> |
|||
Use Get, Post, Put, Patch, Delete, or Head which are exactly the same as Path |
|||
except they set the HTTP method too. |
|||
</p> |
|||
<pre>req, err := sling.New().Post("<a href="http://upload.com/gophers">http://upload.com/gophers</a>") |
|||
</pre> |
|||
<h3 id="hdr-Headers">Headers</h3> |
|||
<p> |
|||
Add or Set headers for requests created by a Sling. |
|||
</p> |
|||
<pre>s := sling.New().Base(baseUrl).Set("User-Agent", "Gophergram API Client") |
|||
req, err := s.New().Get("gophergram/list").Request() |
|||
</pre> |
|||
<h3 id="hdr-QueryStruct">QueryStruct</h3> |
|||
<p> |
|||
Define url parameter structs (<a href="https://godoc.org/github.com/google/go-querystring/query">https://godoc.org/github.com/google/go-querystring/query</a>). |
|||
Use QueryStruct to encode a struct as query parameters on requests. |
|||
</p> |
|||
<pre>// Github Issue Parameters |
|||
type IssueParams struct { |
|||
Filter string `url:"filter,omitempty"` |
|||
State string `url:"state,omitempty"` |
|||
Labels string `url:"labels,omitempty"` |
|||
Sort string `url:"sort,omitempty"` |
|||
Direction string `url:"direction,omitempty"` |
|||
Since string `url:"since,omitempty"` |
|||
} |
|||
|
|||
githubBase := sling.New().Base("<a href="https://api.github.com/">https://api.github.com/</a>").Client(httpClient) |
|||
|
|||
path := fmt.Sprintf("repos/%s/%s/issues", owner, repo) |
|||
params := &IssueParams{Sort: "updated", State: "open"} |
|||
req, err := githubBase.New().Get(path).QueryStruct(params).Request() |
|||
</pre> |
|||
<h3 id="hdr-Json_Body">Json Body</h3> |
|||
<p> |
|||
Define JSON tagged structs (<a href="https://golang.org/pkg/encoding/json/">https://golang.org/pkg/encoding/json/</a>). |
|||
Use BodyJSON to JSON encode a struct as the Body on requests. |
|||
</p> |
|||
<pre>type IssueRequest struct { |
|||
Title string `json:"title,omitempty"` |
|||
Body string `json:"body,omitempty"` |
|||
Assignee string `json:"assignee,omitempty"` |
|||
Milestone int `json:"milestone,omitempty"` |
|||
Labels []string `json:"labels,omitempty"` |
|||
} |
|||
|
|||
githubBase := sling.New().Base("<a href="https://api.github.com/">https://api.github.com/</a>").Client(httpClient) |
|||
path := fmt.Sprintf("repos/%s/%s/issues", owner, repo) |
|||
|
|||
body := &IssueRequest{ |
|||
Title: "Test title", |
|||
Body: "Some issue", |
|||
} |
|||
req, err := githubBase.New().Post(path).BodyJSON(body).Request() |
|||
</pre> |
|||
<p> |
|||
Requests will include an "application/json" Content-Type header. |
|||
</p> |
|||
<h3 id="hdr-Form_Body">Form Body</h3> |
|||
<p> |
|||
Define url tagged structs (<a href="https://godoc.org/github.com/google/go-querystring/query">https://godoc.org/github.com/google/go-querystring/query</a>). |
|||
Use BodyForm to form url encode a struct as the Body on requests. |
|||
</p> |
|||
<pre>type StatusUpdateParams struct { |
|||
Status string `url:"status,omitempty"` |
|||
InReplyToStatusId int64 `url:"in_reply_to_status_id,omitempty"` |
|||
MediaIds []int64 `url:"media_ids,omitempty,comma"` |
|||
} |
|||
|
|||
tweetParams := &StatusUpdateParams{Status: "writing some Go"} |
|||
req, err := twitterBase.New().Post(path).BodyForm(tweetParams).Request() |
|||
</pre> |
|||
<p> |
|||
Requests will include an "application/x-www-form-urlencoded" Content-Type |
|||
header. |
|||
</p> |
|||
<h3 id="hdr-Plain_Body">Plain Body</h3> |
|||
<p> |
|||
Use Body to set a plain io.Reader on requests created by a Sling. |
|||
</p> |
|||
<pre>body := strings.NewReader("raw body") |
|||
req, err := sling.New().Base("<a href="https://example.com">https://example.com</a>").Body(body).Request() |
|||
</pre> |
|||
<p> |
|||
Set a content type header, if desired (e.g. Set("Content-Type", "text/plain")). |
|||
</p> |
|||
<h3 id="hdr-Extend_a_Sling">Extend a Sling</h3> |
|||
<p> |
|||
Each Sling generates an http.Request (say with some path and query params) |
|||
each time Request() is called, based on its state. When creating |
|||
different slings, you may wish to extend an existing Sling to minimize |
|||
duplication (e.g. a common client). |
|||
</p> |
|||
<p> |
|||
Each Sling instance provides a New() method which creates an independent copy, |
|||
so setting properties on the child won't mutate the parent Sling. |
|||
</p> |
|||
<pre>const twitterApi = "<a href="https://api.twitter.com/1.1/">https://api.twitter.com/1.1/</a>" |
|||
base := sling.New().Base(twitterApi).Client(authClient) |
|||
|
|||
// statuses/show.json Sling |
|||
tweetShowSling := base.New().Get("statuses/show.json").QueryStruct(params) |
|||
req, err := tweetShowSling.Request() |
|||
|
|||
// statuses/update.json Sling |
|||
tweetPostSling := base.New().Post("statuses/update.json").BodyForm(params) |
|||
req, err := tweetPostSling.Request() |
|||
</pre> |
|||
<p> |
|||
Without the calls to base.New(), tweetShowSling and tweetPostSling would |
|||
reference the base Sling and POST to |
|||
"<a href="https://api.twitter.com/1.1/statuses/show.json/statuses/update.json">https://api.twitter.com/1.1/statuses/show.json/statuses/update.json</a>", which |
|||
is undesired. |
|||
</p> |
|||
<p> |
|||
Recap: If you wish to extend a Sling, create a new child copy with New(). |
|||
</p> |
|||
<h3 id="hdr-Receive">Receive</h3> |
|||
<p> |
|||
Define a JSON struct to decode a type from 2XX success responses. Use |
|||
ReceiveSuccess(successV interface{}) to send a new Request and decode the |
|||
response body into successV if it succeeds. |
|||
</p> |
|||
<pre>// Github Issue (abbreviated) |
|||
type Issue struct { |
|||
Title string `json:"title"` |
|||
Body string `json:"body"` |
|||
} |
|||
|
|||
issues := new([]Issue) |
|||
resp, err := githubBase.New().Get(path).QueryStruct(params).ReceiveSuccess(issues) |
|||
fmt.Println(issues, resp, err) |
|||
</pre> |
|||
<p> |
|||
Most APIs return failure responses with JSON error details. To decode these, |
|||
define success and failure JSON structs. Use |
|||
Receive(successV, failureV interface{}) to send a new Request that will |
|||
automatically decode the response into the successV for 2XX responses or into |
|||
failureV for non-2XX responses. |
|||
</p> |
|||
<pre>type GithubError struct { |
|||
Message string `json:"message"` |
|||
Errors []struct { |
|||
Resource string `json:"resource"` |
|||
Field string `json:"field"` |
|||
Code string `json:"code"` |
|||
} `json:"errors"` |
|||
DocumentationURL string `json:"documentation_url"` |
|||
} |
|||
|
|||
issues := new([]Issue) |
|||
githubError := new(GithubError) |
|||
resp, err := githubBase.New().Get(path).QueryStruct(params).Receive(issues, githubError) |
|||
fmt.Println(issues, githubError, resp, err) |
|||
</pre> |
|||
<p> |
|||
Pass a nil successV or failureV argument to skip JSON decoding into that value. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Doer">type Doer</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Sling">type Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#New">func New() *Sling</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Add">func (s *Sling) Add(key, value string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Base">func (s *Sling) Base(rawURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Body">func (s *Sling) Body(body io.Reader) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.BodyForm">func (s *Sling) BodyForm(bodyForm interface{}) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.BodyJSON">func (s *Sling) BodyJSON(bodyJSON interface{}) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Client">func (s *Sling) Client(httpClient *http.Client) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Delete">func (s *Sling) Delete(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Do">func (s *Sling) Do(req *http.Request, successV, failureV interface{}) (*http.Response, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Doer">func (s *Sling) Doer(doer Doer) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Get">func (s *Sling) Get(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Head">func (s *Sling) Head(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.New">func (s *Sling) New() *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Patch">func (s *Sling) Patch(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Path">func (s *Sling) Path(path string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Post">func (s *Sling) Post(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Put">func (s *Sling) Put(pathURL string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.QueryStruct">func (s *Sling) QueryStruct(queryStruct interface{}) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Receive">func (s *Sling) Receive(successV, failureV interface{}) (*http.Response, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.ReceiveSuccess">func (s *Sling) ReceiveSuccess(successV interface{}) (*http.Response, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Request">func (s *Sling) Request() (*http.Request, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.Set">func (s *Sling) Set(key, value string) *Sling</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Sling.SetBasicAuth">func (s *Sling) SetBasicAuth(username, password string) *Sling</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/sling/doc.go">doc.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go">sling.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Doer">type <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=479:549#L15">Doer</a></h2> |
|||
<pre>type Doer interface { |
|||
Do(req *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Request">Request</a>) (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Response">Response</a>, <a href="../../../builtin/index.html#error">error</a>) |
|||
}</pre> |
|||
<p> |
|||
Doer executes http requests. It is implemented by *http.Client. You can |
|||
wrap *http.Client with layers of Doers to form a stack of client-side |
|||
middleware. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Sling">type <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=599:1052#L20">Sling</a></h2> |
|||
<pre>type Sling struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Sling is an HTTP Request builder and sender. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="New">func <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=1109:1126#L40">New</a></h3> |
|||
<pre>func New() *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
New returns a new Sling with an http DefaultClient. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Add">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3957:4002#L143">Add</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Add(key, value <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Add adds the key, value pair in Headers, appending values for existing keys |
|||
to the key's values. Header keys are canonicalized. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Base">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=4979:5021#L173">Base</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Base(rawURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Base sets the rawURL. If you intend to extend the url with Path, |
|||
baseUrl should be specified with a trailing slash. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Body">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=7058:7101#L232">Body</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Body(body <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Reader">Reader</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Body sets the Sling's body. The body value will be set as the Body on new |
|||
requests (see Request()). |
|||
If the provided body is also an io.Closer, the request Body will be closed |
|||
by http.Client methods. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.BodyForm">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=6691:6744#L220">BodyForm</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) BodyForm(bodyForm interface{}) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
BodyForm sets the Sling's bodyForm. The value pointed to by the bodyForm |
|||
will be url encoded as the Body on new requests (see Request()). |
|||
The bodyStruct argument should be a pointer to a url tagged struct. See |
|||
<a href="https://godoc.org/github.com/google/go-querystring/query">https://godoc.org/github.com/google/go-querystring/query</a> for details. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.BodyJSON">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=6243:6296#L208">BodyJSON</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) BodyJSON(bodyJSON interface{}) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
BodyJSON sets the Sling's bodyJSON. The value pointed to by the bodyJSON |
|||
will be JSON encoded as the Body on new requests (see Request()). |
|||
The bodyJSON argument should be a pointer to a JSON tagged struct. See |
|||
<a href="https://golang.org/pkg/encoding/json/#MarshalIndent">https://golang.org/pkg/encoding/json/#MarshalIndent</a> for details. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Client">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=2425:2479#L83">Client</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Client(httpClient *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Client">Client</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Client sets the http Client used to do requests. If a nil client is given, |
|||
the http.DefaultClient will be used. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Delete">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3716:3761#L134">Delete</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Delete(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Delete sets the Sling method to DELETE and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Do">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=11412:11505#L375">Do</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Do(req *<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Request">Request</a>, successV, failureV interface{}) (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Response">Response</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Do sends an HTTP request and returns the response. Success responses (2XX) |
|||
are JSON decoded into the value pointed to by successV and other responses |
|||
are JSON decoded into the value pointed to by failureV. |
|||
Any error sending the request or decoding the response is returned. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Doer">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=2706:2744#L92">Doer</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Doer(doer <a href="index.html#Doer">Doer</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Doer sets the custom Doer implementation used to do requests. |
|||
If a nil client is given, the http.DefaultClient will be used. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Get">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3082:3124#L110">Get</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Get(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Get sets the Sling method to GET and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Head">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=2926:2969#L104">Head</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Head(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Head sets the Sling method to HEAD and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.New">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=1859:1887#L61">New</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) New() *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
New returns a copy of a Sling for creating a new Sling with properties |
|||
from a parent Sling. For example, |
|||
</p> |
|||
<pre>parentSling := sling.New().Client(client).Base("<a href="https://api.io/">https://api.io/</a>") |
|||
fooSling := parentSling.New().Get("foo/") |
|||
barSling := parentSling.New().Get("bar/") |
|||
</pre> |
|||
<p> |
|||
fooSling and barSling will both use the same client, but send requests to |
|||
<a href="https://api.io/foo/">https://api.io/foo/</a> and <a href="https://api.io/bar/">https://api.io/bar/</a> respectively. |
|||
</p> |
|||
<p> |
|||
Note that query and body values are copied so if pointer values are used, |
|||
mutating the original value will mutate the value within the child Sling. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Patch">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3552:3596#L128">Patch</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Patch(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Patch sets the Sling method to PATCH and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Path">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=5209:5249#L180">Path</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Path(path <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Path extends the rawURL with the given path by resolving the reference to |
|||
an absolute URL. If parsing errors occur, the rawURL is left unmodified. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Post">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3238:3281#L116">Post</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Post(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Post sets the Sling method to POST and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Put">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=3394:3436#L122">Put</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Put(pathURL <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Put sets the Sling method to PUT and sets the given pathURL. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.QueryStruct">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=5789:5848#L195">QueryStruct</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) QueryStruct(queryStruct interface{}) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
QueryStruct appends the queryStruct to the Sling's queryStructs. The value |
|||
pointed to by each queryStruct will be encoded as url query parameters on |
|||
new requests (see Request()). |
|||
The queryStruct argument should be a pointer to a url tagged struct. See |
|||
<a href="https://godoc.org/github.com/google/go-querystring/query">https://godoc.org/github.com/google/go-querystring/query</a> for details. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Receive">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=10940:11019#L363">Receive</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Receive(successV, failureV interface{}) (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Response">Response</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Receive creates a new HTTP request and returns the response. Success |
|||
responses (2XX) are JSON decoded into the value pointed to by successV and |
|||
other responses are JSON decoded into the value pointed to by failureV. |
|||
Any error creating the request, sending it, or decoding the response is |
|||
returned. |
|||
Receive is shorthand for calling Request and Do. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.ReceiveSuccess">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=10460:10536#L353">ReceiveSuccess</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) ReceiveSuccess(successV interface{}) (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Response">Response</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
ReceiveSuccess creates a new HTTP request and returns the response. Success |
|||
responses (2XX) are JSON decoded into the value pointed to by successV. |
|||
Any error creating the request, sending it, or decoding a 2XX response |
|||
is returned. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Request">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=7444:7492#L248">Request</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Request() (*<a href="../../../net/http/index.html">http</a>.<a href="../../../net/http/index.html#Request">Request</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Request returns a new http.Request created with the Sling properties. |
|||
Returns any errors parsing the rawURL, encoding query structs, encoding |
|||
the body, or creating the http.Request. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.Set">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=4169:4214#L150">Set</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) Set(key, value <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
Set sets the key, value pair in Headers, replacing existing values |
|||
associated with key. Header keys are canonicalized. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Sling.SetBasicAuth">func (*Sling) <a href="http://localhost:6060/src/github.com/dghubble/sling/sling.go?s=4467:4529#L158">SetBasicAuth</a></h3> |
|||
<pre>func (s *<a href="index.html#Sling">Sling</a>) SetBasicAuth(username, password <a href="../../../builtin/index.html#string">string</a>) *<a href="index.html#Sling">Sling</a></pre> |
|||
<p> |
|||
SetBasicAuth sets the Authorization header to use HTTP Basic Authentication |
|||
with the provided username and password. With HTTP Basic Authentication |
|||
the provided username and password are not encrypted. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-subdirectories">Subdirectories</h2> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="examples/index.html">examples</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/die-net - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/die-net</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="lrucache/index.html">lrucache</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package lrucache provides a byte-size-limited implementation of httpcache.Cache that stores data in memory. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="lrucache/twotier/index.html">twotier</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twotier provides a wrapper for two httpcache.Cache instances, allowing you to use both a small and fast cache for popular objects and fall back to a larger and slower cache for less popular ones. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,351 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>lrucache - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package lrucache</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/die-net/lrucache"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package lrucache provides a byte-size-limited implementation of |
|||
httpcache.Cache that stores data in memory. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#LruCache">type LruCache</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#New">func New(maxSize int64, maxAge int64) *LruCache</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#LruCache.Delete">func (c *LruCache) Delete(key string)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#LruCache.Get">func (c *LruCache) Get(key string) ([]byte, bool)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#LruCache.Set">func (c *LruCache) Set(key string, value []byte)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#LruCache.Size">func (c *LruCache) Size() int64</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go">lrucache.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="LruCache">type <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=454:615#L5">LruCache</a></h2> |
|||
<pre>type LruCache struct { |
|||
MaxSize <a href="../../../builtin/index.html#int64">int64</a> |
|||
MaxAge <a href="../../../builtin/index.html#int64">int64</a> |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
LruCache is a thread-safe, in-memory httpcache.Cache that evicts the |
|||
least recently used entries from memory when either MaxSize (in bytes) |
|||
limit would be exceeded or (if set) the entries are older than MaxAge (in |
|||
seconds). Use the New constructor to create one. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="New">func <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=771:818#L18">New</a></h3> |
|||
<pre>func New(maxSize <a href="../../../builtin/index.html#int64">int64</a>, maxAge <a href="../../../builtin/index.html#int64">int64</a>) *<a href="index.html#LruCache">LruCache</a></pre> |
|||
<p> |
|||
New creates an LruCache that will restrict itself to maxSize bytes of |
|||
memory. If maxAge > 0, entries will also be expired after maxAge |
|||
seconds. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="LruCache.Delete">func (*LruCache) <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=2155:2192#L82">Delete</a></h3> |
|||
<pre>func (c *<a href="index.html#LruCache">LruCache</a>) Delete(key <a href="../../../builtin/index.html#string">string</a>)</pre> |
|||
<p> |
|||
Delete removes the value associated with a key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="LruCache.Get">func (*LruCache) <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=1070:1119#L31">Get</a></h3> |
|||
<pre>func (c *<a href="index.html#LruCache">LruCache</a>) Get(key <a href="../../../builtin/index.html#string">string</a>) ([]<a href="../../../builtin/index.html#byte">byte</a>, <a href="../../../builtin/index.html#bool">bool</a>)</pre> |
|||
<p> |
|||
Get returns the []byte representation of a cached response and a bool |
|||
set to true if the key was found. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="LruCache.Set">func (*LruCache) <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=1613:1661#L56">Set</a></h3> |
|||
<pre>func (c *<a href="index.html#LruCache">LruCache</a>) Set(key <a href="../../../builtin/index.html#string">string</a>, value []<a href="../../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Set stores the []byte representation of a response for a given key. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="LruCache.Size">func (*LruCache) <a href="http://localhost:6060/src/github.com/die-net/lrucache/lrucache.go?s=2350:2381#L93">Size</a></h3> |
|||
<pre>func (c *<a href="index.html#LruCache">LruCache</a>) Size() <a href="../../../builtin/index.html#int64">int64</a></pre> |
|||
<p> |
|||
Size returns the estimated current memory usage of LruCache. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="pkg-subdirectories">Subdirectories</h2> |
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="twotier/index.html">twotier</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package twotier provides a wrapper for two httpcache.Cache instances, allowing you to use both a small and fast cache for popular objects and fall back to a larger and slower cache for less popular ones. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,297 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>twotier - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package twotier</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/die-net/lrucache/twotier"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package twotier provides a wrapper for two httpcache.Cache instances, |
|||
allowing you to use both a small and fast cache for popular objects and |
|||
fall back to a larger and slower cache for less popular ones. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#TwoTier">type TwoTier</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#New">func New(first httpcache.Cache, second httpcache.Cache) *TwoTier</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#TwoTier.Delete">func (c *TwoTier) Delete(key string)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#TwoTier.Get">func (c *TwoTier) Get(key string) ([]byte, bool)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#TwoTier.Set">func (c *TwoTier) Set(key string, value []byte)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go">twotier.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="TwoTier">type <a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go?s=426:497#L2">TwoTier</a></h2> |
|||
<pre>type TwoTier struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
TwoTier creates a two-tiered cache out of two httpcache.Cache instances. |
|||
Reads are favored from first, and writes affect both first and second. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="New">func <a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go?s=564:628#L8">New</a></h3> |
|||
<pre>func New(first <a href="../../../gregjones/httpcache/index.html">httpcache</a>.<a href="../../../gregjones/httpcache/index.html#Cache">Cache</a>, second <a href="../../../gregjones/httpcache/index.html">httpcache</a>.<a href="../../../gregjones/httpcache/index.html#Cache">Cache</a>) *<a href="index.html#TwoTier">TwoTier</a></pre> |
|||
<p> |
|||
New creates a TwoTier. Both first and second must be non-nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="TwoTier.Delete">func (*TwoTier) <a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go?s=1577:1613#L44">Delete</a></h3> |
|||
<pre>func (c *<a href="index.html#TwoTier">TwoTier</a>) Delete(key <a href="../../../../builtin/index.html#string">string</a>)</pre> |
|||
<p> |
|||
Delete removes the value associated with a key from both the first and |
|||
second tier caches. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="TwoTier.Get">func (*TwoTier) <a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go?s=990:1038#L19">Get</a></h3> |
|||
<pre>func (c *<a href="index.html#TwoTier">TwoTier</a>) Get(key <a href="../../../../builtin/index.html#string">string</a>) ([]<a href="../../../../builtin/index.html#byte">byte</a>, <a href="../../../../builtin/index.html#bool">bool</a>)</pre> |
|||
<p> |
|||
Get returns the []byte representation of a cached response and a bool set |
|||
to true if the key was found. It tries the first tier cache, and if |
|||
that's not successful, copies the result from the second tier into the |
|||
first tier. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="TwoTier.Set">func (*TwoTier) <a href="http://localhost:6060/src/github.com/die-net/lrucache/twotier/twotier.go?s=1380:1427#L37">Set</a></h3> |
|||
<pre>func (c *<a href="index.html#TwoTier">TwoTier</a>) Set(key <a href="../../../../builtin/index.html#string">string</a>, value []<a href="../../../../builtin/index.html#byte">byte</a>)</pre> |
|||
<p> |
|||
Set stores the []byte representation of a response for a given key into |
|||
the second tier cache, and deletes the cache entry from the first tier |
|||
cache. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/garyburd - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/garyburd</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="redigo/index.html">redigo</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="redigo/redis/index.html">redis</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package redis is a client for the Redis database. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/garyburd/redigo - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/garyburd/redigo</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="redis/index.html">redis</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package redis is a client for the Redis database. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
2264
pkg/github.com/garyburd/redigo/redis/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,163 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/golang - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/golang</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="protobuf/index.html">protobuf</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="protobuf/proto/index.html">proto</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package proto converts data structures to and from the wire format of protocol buffers. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 40px;"> |
|||
<a href="protobuf/proto/proto3_proto/index.html">proto3_proto</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package proto3_proto is a generated protocol buffer package. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="snappy/index.html">snappy</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package snappy implements the snappy block-based compression format. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,141 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/golang/protobuf - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/golang/protobuf</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="proto/index.html">proto</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package proto converts data structures to and from the wire format of protocol buffers. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="proto/proto3_proto/index.html">proto3_proto</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package proto3_proto is a generated protocol buffer package. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
2397
pkg/github.com/golang/protobuf/proto/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,615 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>proto3_proto - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package proto3_proto</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/golang/protobuf/proto/proto3_proto"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package proto3_proto is a generated protocol buffer package. |
|||
</p> |
|||
<p> |
|||
It is generated from these files: |
|||
</p> |
|||
<pre>proto3_proto/proto3.proto |
|||
</pre> |
|||
<p> |
|||
It has these top-level messages: |
|||
</p> |
|||
<pre>Message |
|||
Nested |
|||
MessageWithMap |
|||
</pre> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Message">type Message</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Message.Descriptor">func (*Message) Descriptor() ([]byte, []int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetAnything">func (m *Message) GetAnything() *google_protobuf.Any</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetChildren">func (m *Message) GetChildren() []*Message</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetManyThings">func (m *Message) GetManyThings() []*google_protobuf.Any</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetNested">func (m *Message) GetNested() *Nested</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetProto2Field">func (m *Message) GetProto2Field() *testdata.SubDefaults</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetProto2Value">func (m *Message) GetProto2Value() map[string]*testdata.SubDefaults</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetSubmessage">func (m *Message) GetSubmessage() *Message</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.GetTerrain">func (m *Message) GetTerrain() map[string]*Nested</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.ProtoMessage">func (*Message) ProtoMessage()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.Reset">func (m *Message) Reset()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message.String">func (m *Message) String() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#MessageWithMap">type MessageWithMap</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#MessageWithMap.Descriptor">func (*MessageWithMap) Descriptor() ([]byte, []int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#MessageWithMap.GetByteMapping">func (m *MessageWithMap) GetByteMapping() map[bool][]byte</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#MessageWithMap.ProtoMessage">func (*MessageWithMap) ProtoMessage()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#MessageWithMap.Reset">func (m *MessageWithMap) Reset()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#MessageWithMap.String">func (m *MessageWithMap) String() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Message_Humour">type Message_Humour</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Message_Humour.EnumDescriptor">func (Message_Humour) EnumDescriptor() ([]byte, []int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Message_Humour.String">func (x Message_Humour) String() string</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Nested">type Nested</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Nested.Descriptor">func (*Nested) Descriptor() ([]byte, []int)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Nested.ProtoMessage">func (*Nested) ProtoMessage()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Nested.Reset">func (m *Nested) Reset()</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Nested.String">func (m *Nested) String() string</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go">proto3.pb.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var <span id="Message_Humour_name">Message_Humour_name</span> = map[<a href="../../../../../builtin/index.html#int32">int32</a>]<a href="../../../../../builtin/index.html#string">string</a>{ |
|||
0: "UNKNOWN", |
|||
1: "PUNS", |
|||
2: "SLAPSTICK", |
|||
3: "BILL_BAILEY", |
|||
}</pre> |
|||
|
|||
|
|||
<pre>var <span id="Message_Humour_value">Message_Humour_value</span> = map[<a href="../../../../../builtin/index.html#string">string</a>]<a href="../../../../../builtin/index.html#int32">int32</a>{ |
|||
"UNKNOWN": 0, |
|||
"PUNS": 1, |
|||
"SLAPSTICK": 2, |
|||
"BILL_BAILEY": 3, |
|||
}</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Message">type <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=1453:3872#L50">Message</a></h2> |
|||
<pre>type Message struct { |
|||
Name <a href="../../../../../builtin/index.html#string">string</a> `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` |
|||
Hilarity <a href="index.html#Message_Humour">Message_Humour</a> `protobuf:"varint,2,opt,name=hilarity,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` |
|||
HeightInCm <a href="../../../../../builtin/index.html#uint32">uint32</a> `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm" json:"height_in_cm,omitempty"` |
|||
Data []<a href="../../../../../builtin/index.html#byte">byte</a> `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` |
|||
ResultCount <a href="../../../../../builtin/index.html#int64">int64</a> `protobuf:"varint,7,opt,name=result_count,json=resultCount" json:"result_count,omitempty"` |
|||
TrueScotsman <a href="../../../../../builtin/index.html#bool">bool</a> `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman" json:"true_scotsman,omitempty"` |
|||
Score <a href="../../../../../builtin/index.html#float32">float32</a> `protobuf:"fixed32,9,opt,name=score" json:"score,omitempty"` |
|||
Key []<a href="../../../../../builtin/index.html#uint64">uint64</a> `protobuf:"varint,5,rep,name=key" json:"key,omitempty"` |
|||
ShortKey []<a href="../../../../../builtin/index.html#int32">int32</a> `protobuf:"varint,19,rep,name=short_key,json=shortKey" json:"short_key,omitempty"` |
|||
Nested *<a href="index.html#Nested">Nested</a> `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"` |
|||
RFunny []<a href="index.html#Message_Humour">Message_Humour</a> `protobuf:"varint,16,rep,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` |
|||
Terrain map[<a href="../../../../../builtin/index.html#string">string</a>]*<a href="index.html#Nested">Nested</a> `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` |
|||
Proto2Field *<a href="../testdata/index.html">testdata</a>.<a href="../testdata/index.html#SubDefaults">SubDefaults</a> `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"` |
|||
Proto2Value map[<a href="../../../../../builtin/index.html#string">string</a>]*<a href="../testdata/index.html">testdata</a>.<a href="../testdata/index.html#SubDefaults">SubDefaults</a> `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` |
|||
Anything *<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/">google_protobuf</a>.<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/#Any">Any</a> `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"` |
|||
ManyThings []*<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/">google_protobuf</a>.<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/#Any">Any</a> `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"` |
|||
Submessage *<a href="index.html#Message">Message</a> `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"` |
|||
Children []*<a href="index.html#Message">Message</a> `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"` |
|||
}</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.Descriptor">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4069:4113#L74">Descriptor</a></h3> |
|||
<pre>func (*<a href="index.html#Message">Message</a>) Descriptor() ([]<a href="../../../../../builtin/index.html#byte">byte</a>, []<a href="../../../../../builtin/index.html#int">int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetAnything">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4588:4640#L104">GetAnything</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetAnything() *<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/">google_protobuf</a>.<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/#Any">Any</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetChildren">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4910:4952#L125">GetChildren</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetChildren() []*<a href="index.html#Message">Message</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetManyThings">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4696:4752#L111">GetManyThings</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetManyThings() []*<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/">google_protobuf</a>.<a href="http://localhost:6060/pkg/github.com/golang/protobuf/ptypes/any/#Any">Any</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetNested">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4152:4189#L76">GetNested</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetNested() *<a href="index.html#Nested">Nested</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetProto2Field">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4347:4403#L90">GetProto2Field</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetProto2Field() *<a href="../testdata/index.html">testdata</a>.<a href="../testdata/index.html#SubDefaults">SubDefaults</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetProto2Value">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4462:4529#L97">GetProto2Value</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetProto2Value() map[<a href="../../../../../builtin/index.html#string">string</a>]*<a href="../testdata/index.html">testdata</a>.<a href="../testdata/index.html#SubDefaults">SubDefaults</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetSubmessage">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4810:4852#L118">GetSubmessage</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetSubmessage() *<a href="index.html#Message">Message</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.GetTerrain">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4243:4292#L83">GetTerrain</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) GetTerrain() map[<a href="../../../../../builtin/index.html#string">string</a>]*<a href="index.html#Nested">Nested</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.ProtoMessage">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=4021:4051#L73">ProtoMessage</a></h3> |
|||
<pre>func (*<a href="index.html#Message">Message</a>) ProtoMessage()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.Reset">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=3874:3899#L71">Reset</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message.String">func (*Message) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=3938:3971#L72">String</a></h3> |
|||
<pre>func (m *<a href="index.html#Message">Message</a>) String() <a href="../../../../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="MessageWithMap">type <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5450:5681#L142">MessageWithMap</a></h2> |
|||
<pre>type MessageWithMap struct { |
|||
ByteMapping map[<a href="../../../../../builtin/index.html#bool">bool</a>][]<a href="../../../../../builtin/index.html#byte">byte</a> `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"` |
|||
}</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MessageWithMap.Descriptor">func (*MessageWithMap) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5906:5957#L149">Descriptor</a></h3> |
|||
<pre>func (*<a href="index.html#MessageWithMap">MessageWithMap</a>) Descriptor() ([]<a href="../../../../../builtin/index.html#byte">byte</a>, []<a href="../../../../../builtin/index.html#int">int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MessageWithMap.GetByteMapping">func (*MessageWithMap) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5996:6053#L151">GetByteMapping</a></h3> |
|||
<pre>func (m *<a href="index.html#MessageWithMap">MessageWithMap</a>) GetByteMapping() map[<a href="../../../../../builtin/index.html#bool">bool</a>][]<a href="../../../../../builtin/index.html#byte">byte</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MessageWithMap.ProtoMessage">func (*MessageWithMap) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5851:5888#L148">ProtoMessage</a></h3> |
|||
<pre>func (*<a href="index.html#MessageWithMap">MessageWithMap</a>) ProtoMessage()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MessageWithMap.Reset">func (*MessageWithMap) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5683:5715#L146">Reset</a></h3> |
|||
<pre>func (m *<a href="index.html#MessageWithMap">MessageWithMap</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="MessageWithMap.String">func (*MessageWithMap) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5761:5801#L147">String</a></h3> |
|||
<pre>func (m *<a href="index.html#MessageWithMap">MessageWithMap</a>) String() <a href="../../../../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Message_Humour">type <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=828:853#L23">Message_Humour</a></h2> |
|||
<pre>type Message_Humour <a href="../../../../../builtin/index.html#int32">int32</a></pre> |
|||
|
|||
|
|||
|
|||
<pre>const ( |
|||
<span id="Message_UNKNOWN">Message_UNKNOWN</span> <a href="index.html#Message_Humour">Message_Humour</a> = 0 |
|||
<span id="Message_PUNS">Message_PUNS</span> <a href="index.html#Message_Humour">Message_Humour</a> = 1 |
|||
<span id="Message_SLAPSTICK">Message_SLAPSTICK</span> <a href="index.html#Message_Humour">Message_Humour</a> = 2 |
|||
<span id="Message_BILL_BAILEY">Message_BILL_BAILEY</span> <a href="index.html#Message_Humour">Message_Humour</a> = 3 |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message_Humour.EnumDescriptor">func (Message_Humour) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=1357:1411#L48">EnumDescriptor</a></h3> |
|||
<pre>func (<a href="index.html#Message_Humour">Message_Humour</a>) EnumDescriptor() ([]<a href="../../../../../builtin/index.html#byte">byte</a>, []<a href="../../../../../builtin/index.html#int">int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Message_Humour.String">func (Message_Humour) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=1259:1298#L45">String</a></h3> |
|||
<pre>func (x <a href="index.html#Message_Humour">Message_Humour</a>) String() <a href="../../../../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Nested">type <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5008:5175#L132">Nested</a></h2> |
|||
<pre>type Nested struct { |
|||
Bunny <a href="../../../../../builtin/index.html#string">string</a> `protobuf:"bytes,1,opt,name=bunny" json:"bunny,omitempty"` |
|||
Cute <a href="../../../../../builtin/index.html#bool">bool</a> `protobuf:"varint,2,opt,name=cute" json:"cute,omitempty"` |
|||
}</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Nested.Descriptor">func (*Nested) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5368:5411#L140">Descriptor</a></h3> |
|||
<pre>func (*<a href="index.html#Nested">Nested</a>) Descriptor() ([]<a href="../../../../../builtin/index.html#byte">byte</a>, []<a href="../../../../../builtin/index.html#int">int</a>)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Nested.ProtoMessage">func (*Nested) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5321:5350#L139">ProtoMessage</a></h3> |
|||
<pre>func (*<a href="index.html#Nested">Nested</a>) ProtoMessage()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Nested.Reset">func (*Nested) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5177:5201#L137">Reset</a></h3> |
|||
<pre>func (m *<a href="index.html#Nested">Nested</a>) Reset()</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Nested.String">func (*Nested) <a href="http://localhost:6060/src/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go?s=5239:5271#L138">String</a></h3> |
|||
<pre>func (m *<a href="index.html#Nested">Nested</a>) String() <a href="../../../../../builtin/index.html#string">string</a></pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
7762
pkg/github.com/golang/protobuf/proto/testdata/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,507 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>snappy - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package snappy</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/golang/snappy"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package snappy implements the snappy block-based compression format. |
|||
It aims for very high speeds and reasonable compression. |
|||
</p> |
|||
<p> |
|||
The C++ snappy implementation is at <a href="https://github.com/google/snappy">https://github.com/google/snappy</a> |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
<dd><a href="index.html#pkg-variables">Variables</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Decode">func Decode(dst, src []byte) ([]byte, error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#DecodedLen">func DecodedLen(src []byte) (int, error)</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#Encode">func Encode(dst, src []byte) []byte</a></dd> |
|||
|
|||
|
|||
<dd><a href="index.html#MaxEncodedLen">func MaxEncodedLen(srcLen int) int</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Reader">type Reader</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewReader">func NewReader(r io.Reader) *Reader</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Reader.Read">func (r *Reader) Read(p []byte) (int, error)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Reader.Reset">func (r *Reader) Reset(reader io.Reader)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Writer">type Writer</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewBufferedWriter">func NewBufferedWriter(w io.Writer) *Writer</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewWriter">func NewWriter(w io.Writer) *Writer</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Writer.Close">func (w *Writer) Close() error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Writer.Flush">func (w *Writer) Flush() error</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Writer.Reset">func (w *Writer) Reset(writer io.Writer)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#Writer.Write">func (w *Writer) Write(p []byte) (nRet int, errRet error)</a></dd> |
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/snappy/decode.go">decode.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/snappy/decode_amd64.go">decode_amd64.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/snappy/encode.go">encode.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/snappy/encode_amd64.go">encode_amd64.go</a> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/golang/snappy/snappy.go">snappy.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
<h2 id="pkg-variables">Variables</h2> |
|||
|
|||
<pre>var ( |
|||
<span class="comment">// ErrCorrupt reports that the input is invalid.</span> |
|||
<span id="ErrCorrupt">ErrCorrupt</span> = <a href="../../../errors/index.html">errors</a>.<a href="../../../errors/index.html#New">New</a>("snappy: corrupt input") |
|||
<span class="comment">// ErrTooLarge reports that the uncompressed length is too large.</span> |
|||
<span id="ErrTooLarge">ErrTooLarge</span> = <a href="../../../errors/index.html">errors</a>.<a href="../../../errors/index.html#New">New</a>("snappy: decoded block is too large") |
|||
<span class="comment">// ErrUnsupported reports that the input isn't supported.</span> |
|||
<span id="ErrUnsupported">ErrUnsupported</span> = <a href="../../../errors/index.html">errors</a>.<a href="../../../errors/index.html#New">New</a>("snappy: unsupported input") |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Decode">func <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=1599:1643#L45">Decode</a></h2> |
|||
<pre>func Decode(dst, src []<a href="../../../builtin/index.html#byte">byte</a>) ([]<a href="../../../builtin/index.html#byte">byte</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Decode returns the decoded form of src. The returned slice may be a sub- |
|||
slice of dst if dst was large enough to hold the entire decoded block. |
|||
Otherwise, a newly allocated slice will be returned. |
|||
</p> |
|||
<p> |
|||
The dst and src must not overlap. It is valid to pass a nil dst. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="DecodedLen">func <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=723:763#L15">DecodedLen</a></h2> |
|||
<pre>func DecodedLen(src []<a href="../../../builtin/index.html#byte">byte</a>) (<a href="../../../builtin/index.html#int">int</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
DecodedLen returns the length of the decoded block. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Encode">func <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=507:542#L8">Encode</a></h2> |
|||
<pre>func Encode(dst, src []<a href="../../../builtin/index.html#byte">byte</a>) []<a href="../../../builtin/index.html#byte">byte</a></pre> |
|||
<p> |
|||
Encode returns the encoded form of src. The returned slice may be a sub- |
|||
slice of dst if dst was large enough to hold the entire encoded block. |
|||
Otherwise, a newly allocated slice will be returned. |
|||
</p> |
|||
<p> |
|||
The dst and src must not overlap. It is valid to pass a nil dst. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="MaxEncodedLen">func <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=2979:3013#L66">MaxEncodedLen</a></h2> |
|||
<pre>func MaxEncodedLen(srcLen <a href="../../../builtin/index.html#int">int</a>) <a href="../../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
MaxEncodedLen returns the maximum length of a snappy block, given its |
|||
uncompressed length. |
|||
</p> |
|||
<p> |
|||
It will return a negative value if srcLen is too large to encode. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Reader">type <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=2388:2583#L76">Reader</a></h2> |
|||
<pre>type Reader struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Reader is an io.Reader that can read Snappy-compressed bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewReader">func <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=2142:2177#L67">NewReader</a></h3> |
|||
<pre>func NewReader(r <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Reader">Reader</a>) *<a href="index.html#Reader">Reader</a></pre> |
|||
<p> |
|||
NewReader returns a new Reader that decompresses from r, using the framing |
|||
format described at |
|||
<a href="https://github.com/google/snappy/blob/master/framing_format.txt">https://github.com/google/snappy/blob/master/framing_format.txt</a> |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Reader.Read">func (*Reader) <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=3157:3201#L108">Read</a></h3> |
|||
<pre>func (r *<a href="index.html#Reader">Reader</a>) Read(p []<a href="../../../builtin/index.html#byte">byte</a>) (<a href="../../../builtin/index.html#int">int</a>, <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Read satisfies the io.Reader interface. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Reader.Reset">func (*Reader) <a href="http://localhost:6060/src/github.com/golang/snappy/decode.go?s=2757:2797#L89">Reset</a></h3> |
|||
<pre>func (r *<a href="index.html#Reader">Reader</a>) Reset(reader <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Reader">Reader</a>)</pre> |
|||
<p> |
|||
Reset discards any buffered data, resets all state, and switches the Snappy |
|||
reader to read from r. This permits reusing a Reader rather than allocating |
|||
a new one. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Writer">type <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=5300:5796#L132">Writer</a></h2> |
|||
<pre>type Writer struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
Writer is an io.Writer than can write Snappy-compressed bytes. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewBufferedWriter">func <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=5084:5127#L123">NewBufferedWriter</a></h3> |
|||
<pre>func NewBufferedWriter(w <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Writer">Writer</a>) *<a href="index.html#Writer">Writer</a></pre> |
|||
<p> |
|||
NewBufferedWriter returns a new Writer that compresses to w, using the |
|||
framing format described at |
|||
<a href="https://github.com/google/snappy/blob/master/framing_format.txt">https://github.com/google/snappy/blob/master/framing_format.txt</a> |
|||
</p> |
|||
<p> |
|||
The Writer returned buffers writes. Users must call Close to guarantee all |
|||
data has been forwarded to the underlying io.Writer. They may also call |
|||
Flush zero or more times before calling Close. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewWriter">func <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=4603:4638#L109">NewWriter</a></h3> |
|||
<pre>func NewWriter(w <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Writer">Writer</a>) *<a href="index.html#Writer">Writer</a></pre> |
|||
<p> |
|||
NewWriter returns a new Writer that compresses to w. |
|||
</p> |
|||
<p> |
|||
The Writer returned does not buffer writes. There is no need to Flush or |
|||
Close such a Writer. |
|||
</p> |
|||
<p> |
|||
Deprecated: the Writer returned is not suitable for many small writes, only |
|||
for few large writes. Use NewBufferedWriter instead, which is efficient |
|||
regardless of the frequency and shape of the writes, and remember to Close |
|||
that Writer when done. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Writer.Close">func (*Writer) <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=9038:9068#L268">Close</a></h3> |
|||
<pre>func (w *<a href="index.html#Writer">Writer</a>) Close() <a href="../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Close calls Flush and then closes the Writer. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Writer.Flush">func (*Writer) <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=8825:8855#L255">Flush</a></h3> |
|||
<pre>func (w *<a href="index.html#Writer">Writer</a>) Flush() <a href="../../../builtin/index.html#error">error</a></pre> |
|||
<p> |
|||
Flush flushes the Writer to its underlying io.Writer. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Writer.Reset">func (*Writer) <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=5948:5988#L152">Reset</a></h3> |
|||
<pre>func (w *<a href="index.html#Writer">Writer</a>) Reset(writer <a href="../../../io/index.html">io</a>.<a href="../../../io/index.html#Writer">Writer</a>)</pre> |
|||
<p> |
|||
Reset discards the writer's state and switches the Snappy writer to write to |
|||
w. This permits reusing a Writer rather than allocating a new one. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Writer.Write">func (*Writer) <a href="http://localhost:6060/src/github.com/golang/snappy/encode.go?s=6139:6196#L162">Write</a></h3> |
|||
<pre>func (w *<a href="index.html#Writer">Writer</a>) Write(p []<a href="../../../builtin/index.html#byte">byte</a>) (nRet <a href="../../../builtin/index.html#int">int</a>, errRet <a href="../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Write satisfies the io.Writer interface. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,781 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>btree - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package btree</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/google/btree"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package btree implements in-memory B-Trees of arbitrary degree. |
|||
</p> |
|||
<p> |
|||
btree implements an in-memory B-Tree for use as an ordered data structure. |
|||
It is not meant for persistent storage solutions. |
|||
</p> |
|||
<p> |
|||
It has a flatter structure than an equivalent red-black or other binary tree, |
|||
which in some cases yields better memory usage and/or performance. |
|||
See some discussion on the matter here: |
|||
</p> |
|||
<pre><a href="http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html">http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html</a> |
|||
</pre> |
|||
<p> |
|||
Note, though, that this project is in no way related to the C++ B-Tree |
|||
implementation written about there. |
|||
</p> |
|||
<p> |
|||
Within this tree, each node contains a slice of items and a (possibly nil) |
|||
slice of children. For basic numeric values or raw structs, this can cause |
|||
efficiency differences when compared to equivalent C++ template code that |
|||
stores values in arrays within the node: |
|||
</p> |
|||
<pre>* Due to the overhead of storing values as interfaces (each |
|||
value needs to be stored as the value itself, then 2 words for the |
|||
interface pointing to that value and its type), resulting in higher |
|||
memory use. |
|||
* Since interfaces can point to values anywhere in memory, values are |
|||
most likely not stored in contiguous blocks, resulting in a higher |
|||
number of cache misses. |
|||
</pre> |
|||
<p> |
|||
These issues don't tend to matter, though, when working with strings or other |
|||
heap-allocated structures, since C++-equivalent structures also must store |
|||
pointers and also distribute their values across the heap. |
|||
</p> |
|||
<p> |
|||
This implementation is designed to be a drop-in replacement to gollrb.LLRB |
|||
trees, (<a href="http://github.com/petar/gollrb">http://github.com/petar/gollrb</a>), an excellent and probably the most |
|||
widely used ordered tree implementation in the Go ecosystem currently. |
|||
Its functions, therefore, exactly mirror those of |
|||
llrb.LLRB where possible. Unlike gollrb, though, we currently don't |
|||
support storing multiple equivalent values. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
<dd><a href="index.html#pkg-constants">Constants</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#BTree">type BTree</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#New">func New(degree int) *BTree</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewWithFreeList">func NewWithFreeList(degree int, f *FreeList) *BTree</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Ascend">func (t *BTree) Ascend(iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.AscendGreaterOrEqual">func (t *BTree) AscendGreaterOrEqual(pivot Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.AscendLessThan">func (t *BTree) AscendLessThan(pivot Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.AscendRange">func (t *BTree) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Delete">func (t *BTree) Delete(item Item) Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.DeleteMax">func (t *BTree) DeleteMax() Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.DeleteMin">func (t *BTree) DeleteMin() Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Descend">func (t *BTree) Descend(iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.DescendGreaterThan">func (t *BTree) DescendGreaterThan(pivot Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.DescendLessOrEqual">func (t *BTree) DescendLessOrEqual(pivot Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.DescendRange">func (t *BTree) DescendRange(lessOrEqual, greaterThan Item, iterator ItemIterator)</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Get">func (t *BTree) Get(key Item) Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Has">func (t *BTree) Has(key Item) bool</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Len">func (t *BTree) Len() int</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Max">func (t *BTree) Max() Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.Min">func (t *BTree) Min() Item</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#BTree.ReplaceOrInsert">func (t *BTree) ReplaceOrInsert(item Item) Item</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#FreeList">type FreeList</a></dd> |
|||
|
|||
|
|||
<dd> <a href="index.html#NewFreeList">func NewFreeList(size int) *FreeList</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Int">type Int</a></dd> |
|||
|
|||
|
|||
|
|||
<dd> <a href="index.html#Int.Less">func (a Int) Less(b Item) bool</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Item">type Item</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#ItemIterator">type ItemIterator</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
<div id="pkg-examples"> |
|||
<h4>Examples</h4> |
|||
<dl> |
|||
|
|||
<dd><a class="exampleLink" href="index.html#example_BTree">BTree</a></dd> |
|||
|
|||
</dl> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/google/btree/btree.go">btree.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
<h2 id="pkg-constants">Constants</h2> |
|||
|
|||
<pre>const ( |
|||
<span id="DefaultFreeListSize">DefaultFreeListSize</span> = 32 |
|||
)</pre> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="BTree">type <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=15979:16064#L527">BTree</a></h2> |
|||
<pre>type BTree struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
BTree is an implementation of a B-Tree. |
|||
</p> |
|||
<p> |
|||
BTree stores Item instances in an ordered structure, allowing easy insertion, |
|||
removal, and iteration. |
|||
</p> |
|||
<p> |
|||
Write operations are not safe for concurrent mutation by multiple |
|||
goroutines, but Read operations are. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="example_BTree" class="toggle"> |
|||
<div class="collapsed"> |
|||
<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p> |
|||
</div> |
|||
<div class="expanded"> |
|||
<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p> |
|||
|
|||
|
|||
|
|||
<p>Code:</p> |
|||
<pre class="code">tr := New(*btreeDegree) |
|||
for i := Int(0); i < 10; i++ { |
|||
tr.ReplaceOrInsert(i) |
|||
} |
|||
fmt.Println("len: ", tr.Len()) |
|||
fmt.Println("get3: ", tr.Get(Int(3))) |
|||
fmt.Println("get100: ", tr.Get(Int(100))) |
|||
fmt.Println("del4: ", tr.Delete(Int(4))) |
|||
fmt.Println("del100: ", tr.Delete(Int(100))) |
|||
fmt.Println("replace5: ", tr.ReplaceOrInsert(Int(5))) |
|||
fmt.Println("replace100:", tr.ReplaceOrInsert(Int(100))) |
|||
fmt.Println("min: ", tr.Min()) |
|||
fmt.Println("delmin: ", tr.DeleteMin()) |
|||
fmt.Println("max: ", tr.Max()) |
|||
fmt.Println("delmax: ", tr.DeleteMax()) |
|||
fmt.Println("len: ", tr.Len()) |
|||
<span class="comment"></pre> |
|||
|
|||
<p>Output:</p> |
|||
<pre class="output">len: 10 |
|||
get3: 3 |
|||
get100: <nil> |
|||
del4: 4 |
|||
del100: <nil> |
|||
replace5: 5 |
|||
replace100: <nil> |
|||
min: 0 |
|||
delmin: 0 |
|||
max: 100 |
|||
delmax: 100 |
|||
len: 8 |
|||
</pre> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="New">func <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=4217:4244#L106">New</a></h3> |
|||
<pre>func New(degree <a href="../../../builtin/index.html#int">int</a>) *<a href="index.html#BTree">BTree</a></pre> |
|||
<p> |
|||
New creates a new B-Tree with the given degree. |
|||
</p> |
|||
<p> |
|||
New(2), for example, will create a 2-3-4 tree (each node contains 1-3 items |
|||
and 2-4 children). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewWithFreeList">func <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=4392:4444#L111">NewWithFreeList</a></h3> |
|||
<pre>func NewWithFreeList(degree <a href="../../../builtin/index.html#int">int</a>, f *<a href="index.html#FreeList">FreeList</a>) *<a href="index.html#BTree">BTree</a></pre> |
|||
<p> |
|||
NewWithFreeList creates a new B-Tree that uses the given node free list. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Ascend">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=19353:19398#L650">Ascend</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Ascend(iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
Ascend calls the iterator for every value in the tree within the range |
|||
[first, last], until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.AscendGreaterOrEqual">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=19063:19134#L641">AscendGreaterOrEqual</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) AscendGreaterOrEqual(pivot <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
AscendGreaterOrEqual calls the iterator for every value in the tree within |
|||
the range [pivot, last], until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.AscendLessThan">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=18764:18829#L632">AscendLessThan</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) AscendLessThan(pivot <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
AscendLessThan calls the iterator for every value in the tree within the range |
|||
[first, pivot), until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.AscendRange">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=18441:18522#L623">AscendRange</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) AscendRange(greaterOrEqual, lessThan <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
AscendRange calls the iterator for every value in the tree within the range |
|||
[greaterOrEqual, lessThan), until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Delete">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=17507:17545#L589">Delete</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Delete(item <a href="index.html#Item">Item</a>) <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
Delete removes an item equal to the passed in item from the tree, returning |
|||
it. If no such item exists, returns nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.DeleteMax">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=17878:17910#L601">DeleteMax</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) DeleteMax() <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
DeleteMax removes the largest item in the tree and returns it. |
|||
If no such item exists, returns nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.DeleteMin">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=17697:17729#L595">DeleteMin</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) DeleteMin() <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
DeleteMin removes the smallest item in the tree and returns it. |
|||
If no such item exists, returns nil. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Descend">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=20556:20602#L686">Descend</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Descend(iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
Descend calls the iterator for every value in the tree within the range |
|||
[last, first], until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.DescendGreaterThan">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=20265:20334#L677">DescendGreaterThan</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) DescendGreaterThan(pivot <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
DescendGreaterThan calls the iterator for every value in the tree within |
|||
the range (pivot, last], until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.DescendLessOrEqual">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=19964:20033#L668">DescendLessOrEqual</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) DescendLessOrEqual(pivot <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
DescendLessOrEqual calls the iterator for every value in the tree within the range |
|||
[pivot, first], until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.DescendRange">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=19635:19717#L659">DescendRange</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) DescendRange(lessOrEqual, greaterThan <a href="index.html#Item">Item</a>, iterator <a href="index.html#ItemIterator">ItemIterator</a>)</pre> |
|||
<p> |
|||
DescendRange calls the iterator for every value in the tree within the range |
|||
[lessOrEqual, greaterThan), until iterator returns false. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Get">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=20804:20838#L695">Get</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Get(key <a href="index.html#Item">Item</a>) <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
Get looks for the key item in the tree, returning it. It returns nil if |
|||
unable to find that item. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Has">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=21210:21244#L713">Has</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Has(key <a href="index.html#Item">Item</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Has returns true if the given key is in the tree. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Len">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=21334:21359#L718">Len</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Len() <a href="../../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
Len returns the number of items currently in the tree. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Max">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=21105:21131#L708">Max</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Max() <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
Max returns the largest item in the tree, or nil if the tree is empty. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.Min">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=20979:21005#L703">Min</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) Min() <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
Min returns the smallest item in the tree, or nil if the tree is empty. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="BTree.ReplaceOrInsert">func (*BTree) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=16819:16866#L564">ReplaceOrInsert</a></h3> |
|||
<pre>func (t *<a href="index.html#BTree">BTree</a>) ReplaceOrInsert(item <a href="index.html#Item">Item</a>) <a href="index.html#Item">Item</a></pre> |
|||
<p> |
|||
ReplaceOrInsert adds the given item to the tree. If an item in the tree |
|||
already equals the given one, it is removed from the tree and returned. |
|||
Otherwise, nil is returned. |
|||
</p> |
|||
<p> |
|||
nil cannot be added to the tree (will panic). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="FreeList">type <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=3258:3300#L70">FreeList</a></h2> |
|||
<pre>type FreeList struct { |
|||
<span class="comment">// contains filtered or unexported fields</span> |
|||
}</pre> |
|||
<p> |
|||
FreeList represents a free list of btree nodes. By default each |
|||
BTree has its own FreeList, but multiple BTrees can share the same |
|||
FreeList. |
|||
Two Btrees using the same freelist are not safe for concurrent write access. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="NewFreeList">func <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=3397:3433#L76">NewFreeList</a></h3> |
|||
<pre>func NewFreeList(size <a href="../../../builtin/index.html#int">int</a>) *<a href="index.html#FreeList">FreeList</a></pre> |
|||
<p> |
|||
NewFreeList creates a new free list. |
|||
size is the maximum size of the returned free list. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Int">type <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=21433:21445#L723">Int</a></h2> |
|||
<pre>type Int <a href="../../../builtin/index.html#int">int</a></pre> |
|||
<p> |
|||
Int implements the Item interface for integers. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 id="Int.Less">func (Int) <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=21488:21518#L726">Less</a></h3> |
|||
<pre>func (a <a href="index.html#Int">Int</a>) Less(b <a href="index.html#Item">Item</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
Less returns true if int(a) < int(b). |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Item">type <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=2623:2915#L48">Item</a></h2> |
|||
<pre>type Item interface { |
|||
<span class="comment">// Less tests whether the current item is less than the given argument.</span> |
|||
<span class="comment">//</span> |
|||
<span class="comment">// This must provide a strict weak ordering.</span> |
|||
<span class="comment">// If !a.Less(b) && !b.Less(a), we treat this to mean a == b (i.e. we can only</span> |
|||
<span class="comment">// hold one of either a or b in the tree).</span> |
|||
Less(than <a href="index.html#Item">Item</a>) <a href="../../../builtin/index.html#bool">bool</a> |
|||
}</pre> |
|||
<p> |
|||
Item represents a single object in the tree. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="ItemIterator">type <a href="http://localhost:6060/src/github.com/google/btree/btree.go?s=4025:4060#L100">ItemIterator</a></h2> |
|||
<pre>type ItemIterator func(i <a href="index.html#Item">Item</a>) <a href="../../../builtin/index.html#bool">bool</a></pre> |
|||
<p> |
|||
ItemIterator allows callers of Ascend* to iterate in-order over portions of |
|||
the tree. When this function returns false, iteration will stop and the |
|||
associated Ascend* function will immediately return. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
14559
pkg/github.com/google/go-github/github/index.html
File diff suppressed because it is too large
View File
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/google/go-github - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/google/go-github</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="github/index.html">github</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package github provides a client for using the GitHub API. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,130 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/google/go-querystring - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/google/go-querystring</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="query/index.html">query</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package query implements encoding of structs into URL query parameters. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,348 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>query - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Package query</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
<script type='text/javascript'> |
|||
document.ANALYSIS_DATA = null; |
|||
document.CALLGRAPH = null; |
|||
</script> |
|||
|
|||
|
|||
|
|||
<div id="short-nav"> |
|||
<dl> |
|||
<dd><code>import "github.com/google/go-querystring/query"</code></dd> |
|||
</dl> |
|||
<dl> |
|||
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd> |
|||
<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd> |
|||
|
|||
|
|||
</dl> |
|||
</div> |
|||
<!-- The package's Name is printed as title by the top-level template --> |
|||
<div id="pkg-overview" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> |
|||
<p> |
|||
Package query implements encoding of structs into URL query parameters. |
|||
</p> |
|||
<p> |
|||
As a simple example: |
|||
</p> |
|||
<pre>type Options struct { |
|||
Query string `url:"q"` |
|||
ShowAll bool `url:"all"` |
|||
Page int `url:"page"` |
|||
} |
|||
|
|||
opt := Options{ "foo", true, 2 } |
|||
v, _ := query.Values(opt) |
|||
fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" |
|||
</pre> |
|||
<p> |
|||
The exact mapping between Go values and url.Values is described in the |
|||
documentation for the Values() function. |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div id="pkg-index" class="toggleVisible"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> |
|||
</div> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> |
|||
|
|||
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> |
|||
<div id="manual-nav"> |
|||
<dl> |
|||
|
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Values">func Values(v interface{}) (url.Values, error)</a></dd> |
|||
|
|||
|
|||
|
|||
<dd><a href="index.html#Encoder">type Encoder</a></dd> |
|||
|
|||
|
|||
|
|||
|
|||
</dl> |
|||
</div><!-- #manual-nav --> |
|||
|
|||
|
|||
|
|||
|
|||
<h4>Package files</h4> |
|||
<p> |
|||
<span style="font-size:90%"> |
|||
|
|||
<a href="http://localhost:6060/src/github.com/google/go-querystring/query/encode.go">encode.go</a> |
|||
|
|||
</span> |
|||
</p> |
|||
|
|||
</div><!-- .expanded --> |
|||
</div><!-- #pkg-index --> |
|||
|
|||
<div id="pkg-callgraph" class="toggle" style="display: none"> |
|||
<div class="collapsed"> |
|||
<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> |
|||
</div> <!-- .expanded --> |
|||
<div class="expanded"> |
|||
<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> |
|||
<p> |
|||
In the call graph viewer below, each node |
|||
is a function belonging to this package |
|||
and its children are the functions it |
|||
calls—perhaps dynamically. |
|||
</p> |
|||
<p> |
|||
The root nodes are the entry points of the |
|||
package: functions that may be called from |
|||
outside the package. |
|||
There may be non-exported or anonymous |
|||
functions among them if they are called |
|||
dynamically from another package. |
|||
</p> |
|||
<p> |
|||
Click a node to visit that function's source code. |
|||
From there you can visit its callers by |
|||
clicking its declaring <code>func</code> |
|||
token. |
|||
</p> |
|||
<p> |
|||
Functions may be omitted if they were |
|||
determined to be unreachable in the |
|||
particular programs or tests that were |
|||
analyzed. |
|||
</p> |
|||
<!-- Zero means show all package entry points. --> |
|||
<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> |
|||
</div> |
|||
</div> <!-- #pkg-callgraph --> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Values">func <a href="http://localhost:6060/src/github.com/google/go-querystring/query/encode.go?s=4057:4103#L103">Values</a></h2> |
|||
<pre>func Values(v interface{}) (<a href="../../../../net/url/index.html">url</a>.<a href="../../../../net/url/index.html#Values">Values</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre> |
|||
<p> |
|||
Values returns the url.Values encoding of v. |
|||
</p> |
|||
<p> |
|||
Values expects to be passed a struct, and traverses it recursively using the |
|||
following encoding rules. |
|||
</p> |
|||
<p> |
|||
Each exported struct field is encoded as a URL parameter unless |
|||
</p> |
|||
<pre>- the field's tag is "-", or |
|||
- the field is empty and its tag specifies the "omitempty" option |
|||
</pre> |
|||
<p> |
|||
The empty values are false, 0, any nil pointer or interface value, any array |
|||
slice, map, or string of length zero, and any time.Time that returns true |
|||
for IsZero(). |
|||
</p> |
|||
<p> |
|||
The URL parameter name defaults to the struct field name but can be |
|||
specified in the struct field's tag value. The "url" key in the struct |
|||
field's tag value is the key name, followed by an optional comma and |
|||
options. For example: |
|||
</p> |
|||
<pre>// Field is ignored by this package. |
|||
Field int `url:"-"` |
|||
|
|||
// Field appears as URL parameter "myName". |
|||
Field int `url:"myName"` |
|||
|
|||
// Field appears as URL parameter "myName" and the field is omitted if |
|||
// its value is empty |
|||
Field int `url:"myName,omitempty"` |
|||
|
|||
// Field appears as URL parameter "Field" (the default), but the field |
|||
// is skipped if empty. Note the leading comma. |
|||
Field int `url:",omitempty"` |
|||
</pre> |
|||
<p> |
|||
For encoding individual field values, the following type-dependent rules |
|||
apply: |
|||
</p> |
|||
<p> |
|||
Boolean values default to encoding as the strings "true" or "false". |
|||
Including the "int" option signals that the field should be encoded as the |
|||
strings "1" or "0". |
|||
</p> |
|||
<p> |
|||
time.Time values default to encoding as RFC3339 timestamps. Including the |
|||
"unix" option signals that the field should be encoded as a Unix time (see |
|||
time.Unix()) |
|||
</p> |
|||
<p> |
|||
Slice and Array values default to encoding as multiple URL values of the |
|||
same name. Including the "comma" option signals that the field should be |
|||
encoded as a single comma-delimited value. Including the "space" option |
|||
similarly encodes the value as a single space-delimited string. Including |
|||
the "semicolon" option will encode the value as a semicolon-delimited string. |
|||
Including the "brackets" option signals that the multiple URL values should |
|||
have "[]" appended to the value name. "numbered" will append a number to |
|||
the end of each incidence of the value name, example: |
|||
name0=value0&name1=value1, etc. |
|||
</p> |
|||
<p> |
|||
Anonymous struct fields are usually encoded as if their inner exported |
|||
fields were fields in the outer struct, subject to the standard Go |
|||
visibility rules. An anonymous struct field with a name given in its URL |
|||
tag is treated as having that name, rather than being anonymous. |
|||
</p> |
|||
<p> |
|||
Non-nil pointer values are encoded as the value pointed to. |
|||
</p> |
|||
<p> |
|||
Nested structs are encoded including parent fields in value names for |
|||
scoping. e.g: |
|||
</p> |
|||
<pre>"user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" |
|||
</pre> |
|||
<p> |
|||
All other values are encoded using their default string representation. |
|||
</p> |
|||
<p> |
|||
Multiple fields that encode to the same URL parameter name will be included |
|||
as multiple URL values of the same name. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2 id="Encoder">type <a href="http://localhost:6060/src/github.com/google/go-querystring/query/encode.go?s=965:1038#L29">Encoder</a></h2> |
|||
<pre>type Encoder interface { |
|||
EncodeValues(key <a href="../../../../builtin/index.html#string">string</a>, v *<a href="../../../../net/url/index.html">url</a>.<a href="../../../../net/url/index.html#Values">Values</a>) <a href="../../../../builtin/index.html#error">error</a> |
|||
}</pre> |
|||
<p> |
|||
Encoder is an interface implemented by any type that wishes to encode |
|||
itself into URL values in a non-standard way. |
|||
</p> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,174 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<meta name="theme-color" content="#375EAB"> |
|||
|
|||
<title>/src/github.com/google - The Go Programming Language</title> |
|||
|
|||
<link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css"> |
|||
|
|||
<link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css"> |
|||
<script type="text/javascript">window.initFuncs = [];</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> |
|||
... |
|||
</div><!-- #lowframe --> |
|||
|
|||
<div id="topbar" class="wide"><div class="container"> |
|||
<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div> |
|||
<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div> |
|||
<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a> |
|||
<form method="GET" action="http://localhost:6060/search"> |
|||
<div id="menu"> |
|||
<a href="http://localhost:6060/doc/">Documents</a> |
|||
<a href="http://localhost:6060/pkg/">Packages</a> |
|||
<a href="http://localhost:6060/project/">The Project</a> |
|||
<a href="http://localhost:6060/help/">Help</a> |
|||
<a href="http://localhost:6060/blog/">Blog</a> |
|||
|
|||
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> |
|||
</div> |
|||
</form> |
|||
|
|||
</div></div> |
|||
|
|||
|
|||
|
|||
<div id="page" class="wide"> |
|||
<div class="container"> |
|||
|
|||
|
|||
<h1>Directory /src/github.com/google</h1> |
|||
|
|||
|
|||
|
|||
|
|||
<div id="nav"></div> |
|||
|
|||
|
|||
<!-- |
|||
Copyright 2009 The Go Authors. All rights reserved. |
|||
Use of this source code is governed by a BSD-style |
|||
license that can be found in the LICENSE file. |
|||
--> |
|||
<!-- |
|||
Note: Static (i.e., not template-generated) href and id |
|||
attributes start with "pkg-" to make it impossible for |
|||
them to conflict with generated attributes (some of which |
|||
correspond to Go identifiers). |
|||
--> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div class="pkg-dir"> |
|||
<table> |
|||
<tr> |
|||
<th class="pkg-name">Name</th> |
|||
<th class="pkg-synopsis">Synopsis</th> |
|||
</tr> |
|||
|
|||
|
|||
<tr> |
|||
<td colspan="2"><a href="../index.html">..</a></td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="btree/index.html">btree</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package btree implements in-memory B-Trees of arbitrary degree. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="go-github/index.html">go-github</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="go-github/github/index.html">github</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package github provides a client for using the GitHub API. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 0px;"> |
|||
<a href="go-querystring/index.html">go-querystring</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
|
|||
<tr> |
|||
<td class="pkg-name" style="padding-left: 20px;"> |
|||
<a href="go-querystring/query/index.html">query</a> |
|||
</td> |
|||
<td class="pkg-synopsis"> |
|||
Package query implements encoding of structs into URL query parameters. |
|||
</td> |
|||
</tr> |
|||
|
|||
|
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="footer"> |
|||
Build version go1.6.<br> |
|||
Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, |
|||
the content of this page is licensed under the |
|||
Creative Commons Attribution 3.0 License, |
|||
and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br> |
|||
<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | |
|||
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> |
|||
</div> |
|||
|
|||
</div><!-- .container --> |
|||
</div><!-- #page --> |
|||
|
|||
<!-- TODO(adonovan): load these from <head> using "defer" attribute? --> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script> |
|||
<script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script> |
|||
|
|||
|
|||
<script type="text/javascript" src="../../../lib/godoc/godocs.js"></script> |
|||
|
|||
</body> |
|||
</html> |
|||
|