Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeValueString ¶
DecodeValueString decodes the given value into a candid string.
func DecodeValuesString ¶
DecodeValuesString decodes the given values into a candid string.
func EncodeValueString ¶
EncodeValueString encodes the given candid string into a byte slice.
Example ¶
package main
import (
"fmt"
"github.com/mohaijiang/agent-go/candid"
)
func main() {
e, _ := candid.EncodeValueString("0")
fmt.Printf("%x\n", e)
}
Output: 4449444c00017c00
Example (Blob) ¶
package main
import (
"fmt"
"github.com/mohaijiang/agent-go/candid"
)
func main() {
e, _ := candid.EncodeValueString("(blob \"deadbeef\")")
fmt.Printf("%x\n", e)
}
Output: 4449444c016d7b0100086465616462656566
func ParseDID ¶
func ParseDID(raw []byte) (did.Description, error)
ParseDID parses the given raw .did files and returns the Program that is defined in it.
Example ¶
package main
import (
"fmt"
"os"
"github.com/mohaijiang/agent-go/candid"
)
func main() {
raw, _ := os.ReadFile("testdata/life.did")
p, _ := candid.ParseDID(raw)
fmt.Println(p)
}
Output: service : { current : () -> text query; next : () -> text; }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.