From 5d1dcea0f50ebc9dbb4a5af787d12654abb6377b Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sat, 9 Dec 2023 17:43:29 +0000 Subject: Hide struct details --- persistence/sqlite/sqliteRepository.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'persistence/sqlite') diff --git a/persistence/sqlite/sqliteRepository.go b/persistence/sqlite/sqliteRepository.go index 5950d51..dfeb23a 100644 --- a/persistence/sqlite/sqliteRepository.go +++ b/persistence/sqlite/sqliteRepository.go @@ -10,17 +10,17 @@ import ( "uvok.de/go/training_fellow/registration" ) -type SqliteRepository struct { - FileName string +type sqliteRepository struct { + fileName string context context.Context } -func NewRepository(fileName string, context context.Context) *SqliteRepository { - repo := SqliteRepository{FileName: fileName, context: context} +func NewRepository(fileName string, context context.Context) *sqliteRepository { + repo := sqliteRepository{fileName: fileName, context: context} return &repo } -func (repo *SqliteRepository) SaveRegistration(registration *registration.Registration) error { +func (repo *sqliteRepository) SaveRegistration(registration *registration.Registration) error { db, err := repo.checkInit() if err != nil { return err @@ -45,7 +45,8 @@ func (repo *SqliteRepository) SaveRegistration(registration *registration.Regist return err } -func (repo *SqliteRepository) GetUnconfirmedRegistrations() ([]*registration.Registration, error) { + +func (repo *sqliteRepository) GetUnconfirmedRegistrations() ([]*registration.Registration, error) { db, err := repo.checkInit() if err != nil { return nil, err @@ -74,13 +75,13 @@ func (repo *SqliteRepository) GetUnconfirmedRegistrations() ([]*registration.Reg return regArray, nil } -func (repo *SqliteRepository) ConfirmRegistration(registrationId string) (*registration.Registration, error) { +func (repo *sqliteRepository) ConfirmRegistration(registrationId string) (*registration.Registration, error) { repo.checkInit() panic("not implemented") // TODO: Implement } -func (repo *SqliteRepository) checkInit() (*sql.DB, error) { - db, err := sql.Open("sqlite", repo.FileName) +func (repo *sqliteRepository) checkInit() (*sql.DB, error) { + db, err := sql.Open("sqlite", repo.fileName) if err != nil { return nil, err } -- cgit v1.2.3