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

v0 state

Back to all declarations

Post

type

Post is a single blog entry.

Value

v0.Post

posts

v0.Tree

// key: zero-padded id string -> \*Post

Open
OID
038755…08b2:4
posts details

Inspect ref

nextID

int

posts holds every published post keyed by its zero-padded id (for deterministic ordering) and nextID is the id assigned to the next post.

Value

0

key

func(id int) string

key returns a fixed-width, zero-padded key so avl.Tree iteration is ordered by numeric id (and thus by publication order).

Open
OID
038755…08b2:6
key details

Inspect func

Publish

func(title string, body string) int

Publish creates a new post authored by the caller and returns its id. It is a state-mutating exported function, so it takes \`cur realm\`.

Open
OID
038755…08b2:8
Publish details

Inspect func

PostCount

func() int

PostCount returns the number of published posts.

Open
OID
038755…08b2:9
PostCount details

Inspect func

snippet

func(body string) string

snippet returns a short one-line preview of the body.

Open
OID
038755…08b2:10
snippet details

Inspect func

Render

func(path string) string

Render lists all posts newest-first at the root, or a single post's full text at path "/\<id>". Render is NOT a crossing function.

Open
OID
038755…08b2:11
Render details

Inspect func

renderPost

func(p *v0.Post) string
Open
OID
038755…08b2:13
renderPost details

Inspect func
Post : type =v0.Post
posts : v0.Tree Inspect
nextID : int =0
key : func(id int) string Inspect
Publish : func(title string, body string) int Inspect
PostCount : func() int Inspect
snippet : func(body string) string Inspect
Render : func(path string) string Inspect
renderList : func() string Inspect
renderPost : func(p *v0.Post) string Inspect