boltease/example/main.go

36 lines
597 B
Go

package main
import (
"fmt"
"os"
"git.bullercodeworks.com/brian/boltease"
)
type ExampleType struct {
Name string `boltease:"name"`
Age int `boltease:"age"`
}
type ExampleSubType struct {
SubName string `boltease:"subname"`
}
func main() {
db, err := boltease.Create("example.db", 0600, nil)
if err != nil {
fmt.Printf("Error Opening File: %s\n", err.Error())
os.Exit(1)
}
err = db.SaveStruct(
[]string{"examples", "example1"},
ExampleType{
Name: "Example 1",
Age: 5,
})
if err != nil {
fmt.Printf("Error saving struct: %s\n", err.Error())
os.Exit(1)
}
}