fg-library/main.go

53 lines
1.3 KiB
Go
Raw Permalink Normal View History

2024-10-03 19:03:18 +01:00
package library
import (
2024-10-05 19:33:00 +01:00
"database/sql"
"github.com/go-chi/chi/v5"
2024-10-03 19:03:18 +01:00
"github.com/google/uuid"
"io/fs"
"time"
)
type Permissions struct {
Authenticate bool `validate:"required"`
Database bool `validate:"required"`
BlobStorage bool `validate:"required"`
InterServiceCommunication bool `validate:"required"`
Resources bool `validate:"required"`
}
type Service struct {
Name string `validate:"required"`
Permissions Permissions `validate:"required"`
ServiceID uuid.UUID `validate:"required"`
}
type InterServiceMessage struct {
ServiceID uuid.UUID `validate:"required"`
ForServiceID uuid.UUID `validate:"required"`
MessageType uint64 `validate:"required"`
SentAt time.Time `validate:"required"`
Message any `validate:"required"`
}
type ServiceInitializationInformation struct {
Domain string `validate:"required"`
Outbox chan<- InterServiceMessage `validate:"required"`
Inbox <-chan InterServiceMessage `validate:"required"`
Router *chi.Mux `validate:"required"`
2024-10-03 19:03:18 +01:00
Configuration map[string]interface{}
ResourceDir fs.FS
}
2024-10-05 19:33:00 +01:00
type DBType int
const (
Sqlite DBType = 0
Postgres DBType = 1
)
type Database struct {
DB *sql.DB
DBType DBType
}