database

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close closes the database connection

func CreateContainer

func CreateContainer(c *Container) error

CreateContainer creates a new container record

func CreateEvent

func CreateEvent(e *Event) error

CreateEvent creates a new event record

func CreateUser

func CreateUser(u *User) error

CreateUser creates a new user record

func DeleteContainer

func DeleteContainer(id int) error

DeleteContainer deletes a container record

func DeleteUser

func DeleteUser(id int) error

DeleteUser deletes a user record

func Initialize

func Initialize() error

Initialize creates the database schema

func UpdateContainer

func UpdateContainer(c *Container) error

UpdateContainer updates a container record

func UpdateUser

func UpdateUser(u *User) error

UpdateUser updates a user record

Types

type Container

type Container struct {
	ID          int
	Name        string
	DisplayName string
	Type        string
	Version     string
	ContainerID string
	Port        string
	Status      string
	CreatedAt   time.Time
	ExpiresAt   time.Time
	VolumeType  string
	VolumePath  string
}

Container represents a database container

func GetContainer

func GetContainer(name string) (*Container, error)

GetContainer retrieves a container by name

func GetContainerByDisplayName added in v0.2.0

func GetContainerByDisplayName(displayName string) (*Container, error)

GetContainerByDisplayName retrieves a container by display name

func GetContainerByID

func GetContainerByID(id int) (*Container, error)

GetContainerByID retrieves a container by ID

func GetExpiredContainers

func GetExpiredContainers() ([]*Container, error)

GetExpiredContainers retrieves containers that have expired

func ListAllContainers

func ListAllContainers() ([]*Container, error)

ListAllContainers retrieves all containers including expired ones

func ListContainers

func ListContainers() ([]*Container, error)

ListContainers retrieves all containers (excluding cleaned up expired ones)

type Event

type Event struct {
	ID          int
	ContainerID int
	EventType   string
	Timestamp   time.Time
	Details     string
}

Event represents a container event

type User

type User struct {
	ID           int
	ContainerID  int
	Username     string
	PasswordHash string
	IsDefault    bool
	CreatedAt    time.Time
}

User represents a database user

func GetDefaultUser

func GetDefaultUser(containerID int) (*User, error)

GetDefaultUser retrieves the default user for a container

func ListUsers

func ListUsers(containerID int) ([]*User, error)

ListUsers retrieves all users for a container

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL