Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 state

Back to all declarations

selfPath

untyped string

selfPath is this realm's own page. A root-relative link resolves against the domain, not the realm, so every link back into it names it in full.

Value

"/r/moul/x/daily/polls/v1"

Poll

type

Poll is a single question with its options and per-address vote tracking.

Value

v1.Poll

polls

[]*v1.Poll

// index i holds the poll with ID i

Value

<zero>

nextID

int

Value

0

CreatePoll

func(question string, options string) int

CreatePoll registers a new poll. options is a comma-separated list; blank entries are dropped. Returns the new poll's id. Crossing function: an EOA invokes it via MsgCall; another realm via polls.CreatePoll(cross, q, opts).

Open
OID
05182b…56b9:5
CreatePoll details

Inspect func

Vote

func(pollID int, optionIndex int)

Vote casts one vote for optionIndex on poll pollID. Each caller address may vote at most once per poll. Crossing function.

Open
OID
05182b…56b9:7
Vote details

Inspect func

parseOptions

func(options string) []string

parseOptions splits a comma-separated option string, trimming whitespace and dropping empties. Pure logic — no realm state.

Open
OID
05182b…56b9:8
parseOptions details

Inspect func

getPoll

func(id int) *v1.Poll

getPoll returns the poll with the given id or panics if it does not exist.

Open
OID
05182b…56b9:9
getPoll details

Inspect func

PollCount

func() int

PollCount returns the number of polls created so far (read-only helper).

Open
OID
05182b…56b9:10
PollCount details

Inspect func

barWidth

untyped bigint

Value

(20 <untyped> bigint)

MaxPolls

untyped bigint

The bounds on what a creator may store. Anyone may create a poll, and the root page renders the newest ones.

Value

(500 <untyped> bigint)

MaxQuestionLen

untyped bigint

The bounds on what a creator may store. Anyone may create a poll, and the root page renders the newest ones.

Value

(200 <untyped> bigint)

MaxOptions

untyped bigint

The bounds on what a creator may store. Anyone may create a poll, and the root page renders the newest ones.

Value

(10 <untyped> bigint)

MaxOptionLen

untyped bigint

The bounds on what a creator may store. Anyone may create a poll, and the root page renders the newest ones.

Value

(64 <untyped> bigint)

IndexRecent

untyped bigint

// polls the root page shows, newest first

Value

(20 <untyped> bigint)

bar

func(count int, total int) string

bar renders a proportional ▓░ bar of fixed width for count out of total.

Open
OID
05182b…56b9:11
bar details

Inspect func

percent

func(count int, total int) int

percent returns the integer percentage of count out of total.

Open
OID
05182b…56b9:12
percent details

Inspect func

total

func(tallies []int) int

total sums a tally slice.

Open
OID
05182b…56b9:13
total details

Inspect func

renderPoll

func(b *strings.Builder, p *v1.Poll)

renderPoll writes one poll's Markdown block into b.

Open
OID
05182b…56b9:14
renderPoll details

Inspect func

Render

func(path string) string

Render produces the Markdown page for gnoweb. It is NOT a crossing function. - "" -> the IndexRecent newest polls - "page/\<n>" -> the n-th page of IndexRecent, newest first (page/1 is "") - "\<id>" -> a single poll by id

Open
OID
05182b…56b9:15
Render details

Inspect func
selfPath : untyped string ="/r/moul/x/daily/polls/v1"
Poll : type =v1.Poll
polls : []*v1.Poll =<zero>
nextID : int =0
CreatePoll : func(question string, options string) int Inspect
Vote : func(pollID int, optionIndex int) Inspect
parseOptions : func(options string) []string Inspect
getPoll : func(id int) *v1.Poll Inspect
PollCount : func() int Inspect
barWidth : untyped bigint =(20 <untyped> bigint)
MaxPolls : untyped bigint =(500 <untyped> bigint)
MaxQuestionLen : untyped bigint =(200 <untyped> bigint)
MaxOptions : untyped bigint =(10 <untyped> bigint)
MaxOptionLen : untyped bigint =(64 <untyped> bigint)
IndexRecent : untyped bigint =(20 <untyped> bigint)
bar : func(count int, total int) string Inspect
percent : func(count int, total int) int Inspect
total : func(tallies []int) int Inspect
renderPoll : func(b *strings.Builder, p *v1.Poll) Inspect
Render : func(path string) string Inspect
caller : func() .uverse.address Inspect