Implemented Epic 1 core kernel and infrastructure stories: Story 1.1: Enhanced DI Container - Added providers for database, health, metrics, and error bus - Extended CoreModule to include all core services Story 1.2: Database Layer with Ent ORM - Created Ent schema for User, Role, Permission, AuditLog entities - Implemented many-to-many relationships (User-Role, Role-Permission) - Created database client wrapper with connection pooling - Added database provider to DI container with migration support Story 1.3: Health Monitoring and Metrics System - Implemented health check registry and interface - Added database health checker - Created Prometheus metrics system with HTTP instrumentation - Added health and metrics providers to DI container Story 1.4: Error Handling and Error Bus - Implemented channel-based error bus - Created ErrorPublisher interface - Added error bus provider with lifecycle management Story 1.5: HTTP Server Foundation - Created HTTP server with Gin framework - Implemented comprehensive middleware stack: - Request ID generation - Structured logging - Panic recovery with error bus integration - Prometheus metrics collection - CORS support - Registered core routes: /healthz, /ready, /metrics - Integrated with FX lifecycle for graceful shutdown All components are integrated via DI container and ready for use.
86 lines
2.6 KiB
Go
86 lines
2.6 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package auditlog
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the auditlog type in the database.
|
|
Label = "audit_log"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldActorID holds the string denoting the actor_id field in the database.
|
|
FieldActorID = "actor_id"
|
|
// FieldAction holds the string denoting the action field in the database.
|
|
FieldAction = "action"
|
|
// FieldTargetID holds the string denoting the target_id field in the database.
|
|
FieldTargetID = "target_id"
|
|
// FieldMetadata holds the string denoting the metadata field in the database.
|
|
FieldMetadata = "metadata"
|
|
// FieldTimestamp holds the string denoting the timestamp field in the database.
|
|
FieldTimestamp = "timestamp"
|
|
// Table holds the table name of the auditlog in the database.
|
|
Table = "audit_logs"
|
|
)
|
|
|
|
// Columns holds all SQL columns for auditlog fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldActorID,
|
|
FieldAction,
|
|
FieldTargetID,
|
|
FieldMetadata,
|
|
FieldTimestamp,
|
|
}
|
|
|
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
|
func ValidColumn(column string) bool {
|
|
for i := range Columns {
|
|
if column == Columns[i] {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var (
|
|
// ActorIDValidator is a validator for the "actor_id" field. It is called by the builders before save.
|
|
ActorIDValidator func(string) error
|
|
// ActionValidator is a validator for the "action" field. It is called by the builders before save.
|
|
ActionValidator func(string) error
|
|
// DefaultTimestamp holds the default value on creation for the "timestamp" field.
|
|
DefaultTimestamp func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the AuditLog queries.
|
|
type OrderOption func(*sql.Selector)
|
|
|
|
// ByID orders the results by the id field.
|
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByActorID orders the results by the actor_id field.
|
|
func ByActorID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldActorID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByAction orders the results by the action field.
|
|
func ByAction(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAction, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTargetID orders the results by the target_id field.
|
|
func ByTargetID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTargetID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTimestamp orders the results by the timestamp field.
|
|
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
|
|
}
|