diff --git a/example/simple.go b/example/simple.go deleted file mode 100644 index 00f2bba..0000000 --- a/example/simple.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "fmt" - "github.com/phamhongviet/godsv" -) - -func main() { - row := godsv.Row{ - "this", - "is", - "a:simple", - "test", - "te\\st", - } - fmt.Println(godsv.Marshal(row)) -} diff --git a/example/simple_test.go b/example/simple_test.go new file mode 100644 index 0000000..0bfd15d --- /dev/null +++ b/example/simple_test.go @@ -0,0 +1,26 @@ +package example + +import ( + "fmt" + + "github.com/phamhongviet/godsv" +) + +func ExampleMarshal() { + row := godsv.Row{ + "this", + "is", + "a:simple", + "test", + "te\\st", + } + fmt.Println(godsv.Marshal(row)) + // Output: + // this:is:a\:simple:test:te\\st +} + +func ExampleUnmarshal() { + fmt.Println(godsv.Unmarshal("this:is:a\\:simple:test:te\\\\st")) + // Output: + // [this is a:simple test te\st] +}