Working on Structure Reflection

This commit is contained in:
2023-05-25 11:11:41 -05:00
parent 4131d1be15
commit 0ac08f775e
3 changed files with 121 additions and 0 deletions

35
example/main.go Normal file
View File

@@ -0,0 +1,35 @@
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)
}
}