remove deprecated code

This commit is contained in:
Carlosokumu 2024-09-06 12:42:24 +03:00
parent 6947b1e4a4
commit 7a12588744
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -8,38 +8,21 @@ import (
) )
type AccountFileHandler struct { type AccountFileHandler struct {
//FilePath string
store db.Db store db.Db
} }
// func NewAccountFileHandler(path string) *AccountFileHandler {
// return &AccountFileHandler{FilePath: path}
// }
func NewAccountFileHandler(store db.Db) *AccountFileHandler { func NewAccountFileHandler(store db.Db) *AccountFileHandler {
return &AccountFileHandler{ return &AccountFileHandler{
store: store, store: store,
} }
} }
// func (afh *AccountFileHandler) ReadAccountData() (map[string]string, error) {
// jsonData, err := os.ReadFile(afh.FilePath)
// if err != nil {
// return nil, err
// }
// var accountData map[string]string
// err = json.Unmarshal(jsonData, &accountData)
// if err != nil {
// return nil, err
// }
// return accountData, nil
// }
func (afh *AccountFileHandler) ReadAccountData(ctx context.Context, sessionId string) (map[string]string, error) { func (afh *AccountFileHandler) ReadAccountData(ctx context.Context, sessionId string) (map[string]string, error) {
var accountData map[string]string var accountData map[string]string
jsonData, err := ReadEntry(ctx, afh.store, sessionId, DATA_ACCOUNT) jsonData, err := ReadEntry(ctx, afh.store, sessionId, DATA_ACCOUNT)
if err != nil {
return nil,err
}
err = json.Unmarshal(jsonData, &accountData) err = json.Unmarshal(jsonData, &accountData)
if err != nil { if err != nil {
return nil, err return nil, err
@ -47,15 +30,6 @@ func (afh *AccountFileHandler) ReadAccountData(ctx context.Context, sessionId st
return accountData, nil return accountData, nil
} }
// func (afh *AccountFileHandler) WriteAccountData(accountData map[string]string) error {
// jsonData, err := json.Marshal(accountData)
// if err != nil {
// return err
// }
// return os.WriteFile(afh.FilePath, jsonData, 0644)
// }
func (afh *AccountFileHandler) WriteAccountData(ctx context.Context, sessionId string, accountData map[string]string) error { func (afh *AccountFileHandler) WriteAccountData(ctx context.Context, sessionId string, accountData map[string]string) error {
_, err := json.Marshal(accountData) _, err := json.Marshal(accountData)
if err != nil { if err != nil {
@ -65,13 +39,6 @@ func (afh *AccountFileHandler) WriteAccountData(ctx context.Context, sessionId s
return nil return nil
} }
// func (afh *AccountFileHandler) EnsureFileExists() error {
// f, err := os.OpenFile(afh.FilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
// if err != nil {
// return err
// }
// return f.Close()
// }
func (afh *AccountFileHandler) EnsureFileExists() error { func (afh *AccountFileHandler) EnsureFileExists() error {
return nil return nil
} }