gohn

package module
v0.0.0-...-9f5049e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2015 License: MIT Imports: 9 Imported by: 0

README

Gohn -- Simple Hacker News Go client.

A simple Go client for the Hacker News API. Items are parsed into protocol buffers.

Example

Download Hacker News items 100 to 1000 with 30 workers to a leveldb database:

go run download/main.go --start 100 --end 1000 --numworkers=30

Iterate through the leveldb database and print the text:

go run readdb/read.go 

Documentation

Overview

Package gohn is a generated protocol buffer package.

It is generated from these files:

hn.proto

It has these top-level messages:

Item

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpWithMax

func ExpWithMax(mean, maxi float64) time.Duration

Types

type Item

type Item struct {
	By               *string `protobuf:"bytes,1,opt,name=by" json:"by,omitempty"`
	Descendants      *int64  `protobuf:"varint,2,opt,name=descendants" json:"descendants,omitempty"`
	Id               *int64  `protobuf:"varint,3,opt,name=id" json:"id,omitempty"`
	Kids             []int64 `protobuf:"varint,4,rep,name=kids" json:"kids,omitempty"`
	Parent           *int64  `protobuf:"varint,5,opt,name=parent" json:"parent,omitempty"`
	Parts            []int64 `protobuf:"varint,6,rep,name=parts" json:"parts,omitempty"`
	Score            *int64  `protobuf:"varint,7,opt,name=score" json:"score,omitempty"`
	Text             *string `protobuf:"bytes,8,opt,name=text" json:"text,omitempty"`
	Time             *int64  `protobuf:"varint,9,opt,name=time" json:"time,omitempty"`
	Title            *string `protobuf:"bytes,10,opt,name=title" json:"title,omitempty"`
	Type             *string `protobuf:"bytes,11,opt,name=type" json:"type,omitempty"`
	Url              *string `protobuf:"bytes,12,opt,name=url" json:"url,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func GetItem

func GetItem(id int) (*Item, error)

Get post or comment with given ID

func TopStories

func TopStories() ([]*Item, error)

Current top 500 stories

func (*Item) GetBy

func (m *Item) GetBy() string

func (*Item) GetDescendants

func (m *Item) GetDescendants() int64

func (*Item) GetId

func (m *Item) GetId() int64

func (*Item) GetKids

func (m *Item) GetKids() []int64

func (*Item) GetParent

func (m *Item) GetParent() int64

func (*Item) GetParts

func (m *Item) GetParts() []int64

func (*Item) GetScore

func (m *Item) GetScore() int64

func (*Item) GetText

func (m *Item) GetText() string

func (*Item) GetTime

func (m *Item) GetTime() int64

func (*Item) GetTitle

func (m *Item) GetTitle() string

func (*Item) GetType

func (m *Item) GetType() string

func (*Item) GetUrl

func (m *Item) GetUrl() string

func (*Item) PrettyString

func (i *Item) PrettyString() string

func (*Item) ProtoMessage

func (*Item) ProtoMessage()

func (*Item) Reset

func (m *Item) Reset()

func (*Item) String

func (m *Item) String() string

Directories

Path Synopsis
Godeps
_workspace/src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
_workspace/src/github.com/golang/protobuf/proto/proto3_proto
Package proto3_proto is a generated protocol buffer package.
Package proto3_proto is a generated protocol buffer package.
Concurrently downloads hacker news items.
Concurrently downloads hacker news items.
Reads hacker news leveldb created by ../download
Reads hacker news leveldb created by ../download

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL