models

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeatureFlag

type FeatureFlag struct {
	ID uint `json:"id" gorm:"primary_key"`

	Enabled   bool   `json:"enabled"`
	Name      string `json:"name" gorm:"unique"`
	Condition string `json:"condition"` // expr-lang expression
}

func (FeatureFlag) TableName

func (FeatureFlag) TableName() string

type Filter

type Filter struct {
	Field    string         `json:"field"`
	Operator FilterOperator `json:"operator"`
	Value    []string       `json:"value"`
}

type FilterOperator

type FilterOperator string
const (
	FilterOperator_Equals             FilterOperator = "="
	FilterOperator_NotEquals          FilterOperator = "!="
	FilterOperator_GreaterThan        FilterOperator = ">"
	FilterOperator_GreaterThanOrEqual FilterOperator = ">="
	FilterOperator_LessThan           FilterOperator = "<"
	FilterOperator_LessThanOrEqual    FilterOperator = "<="
	FilterOperator_Contains           FilterOperator = "contains"
	FilterOperator_NotContains        FilterOperator = "not_contains"
	FilterOperator_StartsWith         FilterOperator = "starts_with"
	FilterOperator_EndsWith           FilterOperator = "ends_with"
	FilterOperator_Between            FilterOperator = "between"
	FilterOperator_NotBetween         FilterOperator = "not_between"
	FilterOperator_In                 FilterOperator = "in"
	FilterOperator_NotIn              FilterOperator = "not_in"
)

type Global

type Global struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Key      string `gorm:"unique"`
	Value    string // can be any JSON-serializable value
	Exported bool   `gorm:"default:false"` // if true, this global will be exported to feature flags
}

func (Global) TableName

func (Global) TableName() string

type Log

type Log struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	Model     Model
	Message   string
	Category  string
	Severity  Severity
}

func (Log) FieldNames

func (l Log) FieldNames() []string

func (Log) TableName

func (Log) TableName() string

type Model

type Model string

type RequestLog

type RequestLog struct {
	ID uint `gorm:"primarykey"`

	Timestamp  time.Time `gorm:"index"`
	VisitorID  string    `gorm:"index"`
	Instance   string
	Path       string
	Latency    time.Duration // Stored as int64 (nanoseconds)
	StatusCode int
	UserAgent  string
	OS         string
	Browser    string
	Referer    string
	BytesSent  int64
	BytesRecv  int64
}

RequestLog stores information about a single request. It's also a database model for database persistence.

func (RequestLog) TableName

func (RequestLog) TableName() string

type Session

type Session struct {
	ID           uint `gorm:"primary_key"`
	CreatedAt    time.Time
	ExpiresAt    time.Time `gorm:"not null"`
	LastActivity time.Time `gorm:"not null"`
	Device       string

	UserID uint   `gorm:"not null"`
	Token  string `gorm:"not null;unique"`
}

func (Session) TableName

func (Session) TableName() string

type Severity

type Severity int
const (
	Severity_None Severity = iota
	Severity_Trace
	Severity_Log
	Severity_Info
	Severity_Warning
	Severity_Error
	Severity_Fatal
	Severity_Max
)

func (*Severity) Clamp

func (s *Severity) Clamp()

func (Severity) String

func (s Severity) String() string

type User

type User struct {
	ID        uint      `gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`

	Username     string    `json:"username" gorm:"not null;unique"`
	DisplayName  string    `json:"display_name"`
	Password     string    `json:"-" gorm:"not null"`
	IsAdmin      bool      `json:"is_admin" gorm:"not null;default:false"`
	LastActivity time.Time `json:"last_activity"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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