Documentation
¶
Index ¶
- type Config
- type DB
- func (db *DB) Close() error
- func (db *DB) CreateService(ctx context.Context, service *models.ServiceConfiguration) error
- func (db *DB) CreateUser(ctx context.Context, user *types.User) error
- func (db *DB) DeleteService(ctx context.Context, instanceID string) error
- func (db *DB) FindServiceBy(ctx context.Context, params types.FindServiceParams) (*models.ServiceConfiguration, error)
- func (db *DB) FindUser(ctx context.Context, params types.FindUserParams) (*types.User, error)
- func (db *DB) GetAllServices(ctx context.Context) ([]models.ServiceConfiguration, error)
- func (db *DB) GetServiceByInstancePrefix(ctx context.Context, prefix string) (*models.ServiceConfiguration, error)
- func (db *DB) GetUICollapsePreferences(ctx context.Context, userID int64) (map[string]bool, error)
- func (db *DB) HasUsers(ctx context.Context) (bool, error)
- func (db *DB) Open() error
- func (db *DB) Path() string
- func (db *DB) UpdateService(ctx context.Context, service *models.ServiceConfiguration) error
- func (db *DB) UpdateUserPassword(ctx context.Context, userID int64, newPasswordHash string) error
- func (db *DB) UpsertUICollapsePreference(ctx context.Context, userID int64, key string, collapsed bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Driver string
Host string
Port string
User string
Password string
DBName string
Path string // For SQLite
}
Config holds database configuration
type DB ¶
DB represents the database connection
func InitDBWithConfig ¶
InitDBWithConfig initializes the database with the provided configuration
func (*DB) CreateService ¶
CreateService creates a new service configuration
func (*DB) CreateUser ¶
CreateUser creates a new user in the database
func (*DB) DeleteService ¶
DeleteService deletes a service configuration by its instance ID
func (*DB) FindServiceBy ¶ added in v0.3.0
func (db *DB) FindServiceBy(ctx context.Context, params types.FindServiceParams) (*models.ServiceConfiguration, error)
FindServiceBy retrieves a service configuration by FindServiceParams
func (*DB) GetAllServices ¶
GetAllServices retrieves all service configurations
func (*DB) GetServiceByInstancePrefix ¶
func (db *DB) GetServiceByInstancePrefix(ctx context.Context, prefix string) (*models.ServiceConfiguration, error)
GetServiceByInstancePrefix retrieves a service configuration by its instance ID prefix
func (*DB) GetUICollapsePreferences ¶ added in v0.3.0
func (*DB) UpdateService ¶
UpdateService updates an existing service configuration
func (*DB) UpdateUserPassword ¶
UpdateUserPassword updates a user's password hash and updated_at timestamp