github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/p/demo/users/users.gno (about)

     1  package users
     2  
     3  import (
     4  	"std"
     5  	"strconv"
     6  )
     7  
     8  //----------------------------------------
     9  // Types
    10  
    11  type User struct {
    12  	Address std.Address
    13  	Name    string
    14  	Profile string
    15  	Number  int
    16  	Invites int
    17  	Inviter std.Address
    18  }
    19  
    20  func (u *User) Render() string {
    21  	str := "## user " + u.Name + "\n" +
    22  		"\n" +
    23  		" * address = " + string(u.Address) + "\n" +
    24  		" * " + strconv.Itoa(u.Invites) + " invites\n"
    25  	if u.Inviter != "" {
    26  		str = str + " * invited by " + string(u.Inviter) + "\n"
    27  	}
    28  	str = str + "\n" +
    29  		u.Profile + "\n"
    30  	return str
    31  }