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

kitindexdemo/v0 package

Overview

Package kitindexdemo is a notes board whose only job is to show gno.land/p/moul/kit/index doing the thing a realm with a store always ends up needing: answering "every note tagged gno" as cheaply as it answers "note 7".

There is no logic of its own here. The records are a kit/store, the two lookups are kit/index, the page is kit/ui, and what is worth reading is the shape: every write touches the store and both indexes in ONE function, which is the entire correctness argument for keeping them in separate containers.

Demo of the p/moul/kit/index library.

Functions

Post

func Post(cur realm, tag, body string) int64

Post files a note under a tag and returns its id.

The store write and both index writes happen here, in this order, in one frame. An abort anywhere in it leaves none of them applied, which is what makes three containers safe to keep apart.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/kitindexdemo/v0" -func "Post" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/kitindexdemo/v0" -func "Post" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Render

func Render(path string) string

Render is the whole public surface. Three pages: the tag list, one tag, one author.

Every row goes through ui.NewTable rather than concatenated pipes, and every caller string through ui.Cell, because a public path is immutable and a Render that ships wrong ships forever.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/x/kitindexdemo/v0.Render()"

Result

Retract

func Retract(cur realm, id int64)

Retract removes a note. Only its author may, and the store and both indexes are unwound together.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/kitindexdemo/v0" -func "Retract" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/kitindexdemo/v0" -func "Retract" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx