func (s *Store) Delete(key string) error {
	defer s.db.Close()
	return s.db.Delete([]byte(key), nil)
}
Delete an item from level db
package microsoft
import (
	"encoding/json"
	"os"
	"time"
	"github.com/syndtr/goleveldb/leveldb"
	"github.com/damonto/ms365/internal/pkg/logger"
)
type AccessToken struct {
	ID           string    `json:"id"`
	Email        string    `json:"email"`
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpireDate   time.Time `json:"expire_date"`
}
type Store struct {
	db *leveldb.DB
}
func NewStore() *Store {
	dir, err := os.Getwd()
	if err != nil {
		logger.Sugar.Fatalf("Can get workdir %v", err)
		os.Exit(1)
	}
	db, err := leveldb.OpenFile(dir+"/database", nil)
	if err != nil {
		logger.Sugar.Fatalf("Unable to create database directory %v", err)
		os.Exit(1)
	}
	return &Store{
		db: db,
	}
}
func (s *Store) Put(key string, accessToken AccessToken) (err error) {
	defer s.db.Close()
	b, err := json.Marshal(accessToken)
	if err != nil {
		return err
	}
	err = s.db.Put([]byte(key), b, nil)
	if err != nil {
		return err
	}
	return nil
}
func (s *Store) Get(key string) (accessToken AccessToken, err error) {
	defer s.db.Close()
	data, err := s.db.Get([]byte(key), nil)
	if err != nil {
		return accessToken, nil
	}
	err = json.Unmarshal(data, &accessToken)
	return
}