Search Apps Documentation Source Content File Folder Download Copy Actions Download

social.gno

0.68 Kb · 26 lines
 1package social
 2
 3import (
 4	"strings"
 5
 6	"gno.land/p/nt/bptree/v0"
 7)
 8
 9var (
10	gUserPostsByAddress bptree.BPTree // user's address -> *UserPosts
11	gUserAddressByName  bptree.BPTree // user's username -> address
12	postsCtr            uint64   // increments Post.id globally
13
14	// gRealmPath is the realm's relative URL path (e.g. "/r/g1.../social"),
15	// derived from the deployed package path at init time.
16	gRealmPath string
17)
18
19func init(cur realm) {
20	pkgPath := cur.PkgPath()
21	// Strip the chain domain (everything before the first "/") to get the
22	// relative path suitable for markdown links: "/r/g1.../social".
23	if idx := strings.Index(pkgPath, "/"); idx >= 0 {
24		gRealmPath = pkgPath[idx:]
25	}
26}