Initial commit.

This commit is contained in:
2024-10-12 13:04:09 +05:00
commit 57937a5845
30 changed files with 816 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package core
import "errors"
// ServiceNameDatastore is a service name for data storage implementation.
const ServiceNameDatastore = "datastore"
var (
// ErrDatastore indicates that error appeared somewhere in data storage service.
ErrDatastore = errors.New("datastore")
// ErrDatastoreServiceIsInvalid appears when data storage implementation isn't conforming to interface.
ErrDatastoreServiceIsInvalid = errors.New("invalid datastore implementation")
)
// DataStore is an interface for data storage implementations.
type DataStore interface{}

View File

@@ -0,0 +1,48 @@
package datastore
import (
"fmt"
"log/slog"
"go.dev.pztrn.name/featurer/server/internal/application"
"go.dev.pztrn.name/featurer/server/internal/services/core"
)
type datastore struct {
app *application.Application
}
// Initialize initializes service.
func Initialize(app *application.Application) error {
plan := &datastore{
app: app,
}
if err := app.RegisterService(plan); err != nil {
return fmt.Errorf("%w: %w", core.ErrDatastore, err)
}
return nil
}
func (p *datastore) ConnectDependencies() error {
return nil
}
func (p *datastore) GetName() string {
return core.ServiceNameDatastore
}
func (p *datastore) Initialize() error {
slog.Info("Initializing data storage...")
return nil
}
func (p *datastore) LaunchStartupTasks() error {
return nil
}
func (p *datastore) Shutdown() error {
return nil
}