ente/pkg/controller.go
Neeraj Gupta 3a278a5446 Refactor
2023-09-15 16:25:29 +05:30

23 lines
367 B
Go

package pkg
import (
"cli-go/internal/api"
"fmt"
bolt "go.etcd.io/bbolt"
)
type ClICtrl struct {
Client *api.Client
DB *bolt.DB
}
func (c *ClICtrl) Init() error {
return c.DB.Update(func(tx *bolt.Tx) error {
_, err := tx.CreateBucketIfNotExists([]byte(AccBucket))
if err != nil {
return fmt.Errorf("create bucket: %s", err)
}
return nil
})
}