-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
40 lines (28 loc) · 903 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
GoETF is a module capable of encoding and decoding byte slices of the ETF type.
The external term format is mainly used in Erlang's distribution system.
Occasionally, it's necessary to encode and decode this particular binary format for communication
between different APIs.
Start by importing the module:
import "github.com/nicolito128/goetf"
You can use the Marshal function to encode values:
func main() {
phrase := "Hello, world!"
data, err := goetf.Marshal(phrase)
if err != nil {
panic(err)
}
fmt.Println("Encoded:", data)
}
Or use Unmarshal to decode the value:
func main() {
data := []byte{...}
var out string
if err := goetf.Unmarshal(data, &out); err != nil {
panic(err)
}
fmt.Println("Output:", out)
}
Alternatively, you can use the NewEncoder or NewDecoder functions to create your owns.
*/
package goetf