github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/boards/z_10_filetest.gno (about)

     1  // PKGPATH: gno.land/r/boards_test
     2  package boards_test
     3  
     4  // SEND: 200000000ugnot
     5  
     6  import (
     7  	"strconv"
     8  
     9  	"gno.land/r/demo/boards"
    10  	"gno.land/r/demo/users"
    11  )
    12  
    13  var (
    14  	bid boards.BoardID
    15  	pid boards.PostID
    16  )
    17  
    18  func init() {
    19  	users.Register("", "gnouser", "my profile")
    20  
    21  	bid = boards.CreateBoard("test_board")
    22  	pid = boards.CreateThread(bid, "First Post in (title)", "Body of the first post. (body)")
    23  }
    24  
    25  func main() {
    26  	println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
    27  	boards.DeletePost(bid, pid, pid, "")
    28  	println("----------------------------------------------------")
    29  	println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
    30  }
    31  
    32  // Output:
    33  // # First Post in (title)
    34  //
    35  // Body of the first post. (body)
    36  // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards?help&__func=CreateReply&bid=1&threadid=1&postid=1&body.type=textarea)] \[[repost](/r/demo/boards?help&__func=CreateRepost&bid=1&postid=1&title.type=textarea&body.type=textarea&dstBoardID.type=textarea)] \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=1)]
    37  //
    38  // ----------------------------------------------------
    39  // thread does not exist with id: 1