dbModel

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: EPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.1.2

type Account struct {
	ID                     uint64 `gorm:"primaryKey"`
	GroupId                uint64 `gorm:"not null"`
	Username               string `gorm:"not null"`
	KeyHash                *string
	HomeDirectory          string `gorm:"not null"`
	IsSuperAdmin           bool   `gorm:"not null"`
	SecureAccessPublicKeys []SecureAccessPublicKey
	CreatedAt              time.Time
	UpdatedAt              time.Time
}

func (Account) TableName added in v0.1.2

func (Account) TableName() string

func (Account) ToEntity added in v0.1.2

func (model Account) ToEntity() (accountEntity entity.Account, err error)

func (Account) ToModel added in v0.1.2

func (Account) ToModel(entity entity.Account) (model Account, err error)

type ActivityRecord

type ActivityRecord struct {
	ID                uint64 `gorm:"primaryKey"`
	RecordLevel       string `gorm:"not null"`
	RecordCode        string `gorm:"not null"`
	AffectedResources []ActivityRecordAffectedResource
	RecordDetails     *string
	OperatorAccountId *uint64
	OperatorIpAddress *string
	CreatedAt         time.Time `gorm:"not null"`
}

func NewActivityRecord

func NewActivityRecord(
	recordId uint64,
	recordLevel, recordCode string,
	affectedResources []ActivityRecordAffectedResource,
	recordDetails *string,
	operatorAccountId *uint64,
	operatorIpAddress *string,
) ActivityRecord

func (ActivityRecord) TableName

func (ActivityRecord) TableName() string

func (ActivityRecord) ToEntity

func (model ActivityRecord) ToEntity() (recordEntity entity.ActivityRecord, err error)

type ActivityRecordAffectedResource added in v0.1.2

type ActivityRecordAffectedResource struct {
	ID                       uint64 `gorm:"primaryKey"`
	SystemResourceIdentifier string `gorm:"not null"`
	ActivityRecordID         uint64 `gorm:"not null"`
}

func (ActivityRecordAffectedResource) TableName added in v0.1.2

type InstalledService

type InstalledService struct {
	Name                 string `gorm:"primarykey;not null"`
	Nature               string `gorm:"not null"`
	Type                 string `gorm:"not null"`
	Version              string `gorm:"not null"`
	StartCmd             string `gorm:"not null"`
	Envs                 *string
	PortBindings         *string
	StopTimeoutSecs      int64
	StopCmdSteps         *string
	PreStartTimeoutSecs  int64
	PreStartCmdSteps     *string
	PostStartTimeoutSecs int64
	PostStartCmdSteps    *string
	PreStopTimeoutSecs   int64
	PreStopCmdSteps      *string
	PostStopTimeoutSecs  int64
	PostStopCmdSteps     *string
	ExecUser             *string
	WorkingDirectory     *string
	StartupFile          *string
	AutoStart            *bool
	AutoRestart          *bool
	TimeoutStartSecs     *uint
	MaxStartRetries      *uint
	LogOutputPath        *string
	LogErrorPath         *string
	AvatarUrl            *string
	CreatedAt            time.Time `gorm:"not null"`
	UpdatedAt            time.Time `gorm:"not null"`
}

func NewInstalledService

func NewInstalledService(
	name, nature, serviceType, version, startCmd string,
	envs []valueObject.ServiceEnv,
	portBindings []valueObject.PortBinding,
	stopSteps, preStartSteps, postStartSteps, preStopSteps, postStopSteps []valueObject.UnixCommand,
	execUser, workingDirectory, startupFile *string,
	autoStart, autoRestart *bool,
	timeoutStartSecs, maxStartRetries *uint,
	logOutputPath, logErrorPath *string,
	avatarUrl *string,
) InstalledService

func (InstalledService) InitialEntries

func (InstalledService) InitialEntries() (entries []interface{}, err error)

func (InstalledService) JoinCmdSteps

func (InstalledService) JoinCmdSteps(cmdSteps []valueObject.UnixCommand) string

func (InstalledService) JoinEnvs

func (InstalledService) JoinEnvs(envs []valueObject.ServiceEnv) string

func (InstalledService) JoinPortBindings

func (InstalledService) JoinPortBindings(portBindings []valueObject.PortBinding) string

func (InstalledService) SplitCmdSteps

func (InstalledService) SplitCmdSteps(cmdStepsStr string) []valueObject.UnixCommand

func (InstalledService) SplitEnvs

func (InstalledService) SplitEnvs(envsStr string) []valueObject.ServiceEnv

func (InstalledService) SplitPortBindings

func (InstalledService) SplitPortBindings(portBindingsStr string) []valueObject.PortBinding

func (InstalledService) TableName

func (InstalledService) TableName() string

func (InstalledService) ToEntity

func (model InstalledService) ToEntity() (serviceEntity entity.InstalledService, err error)

type Mapping

type Mapping struct {
	ID                            uint64 `gorm:"primaryKey"`
	Hostname                      string `gorm:"not null"`
	Path                          string `gorm:"not null"`
	MatchPattern                  string `gorm:"not null"`
	TargetType                    string `gorm:"not null"`
	TargetValue                   *string
	TargetHttpResponseCode        *string
	ShouldUpgradeInsecureRequests *bool
	MarketplaceInstalledItemID    *uint
	MarketplaceInstalledItemName  *string
	MappingSecurityRuleID         *uint64
	CreatedAt                     time.Time `gorm:"not null"`
	UpdatedAt                     time.Time `gorm:"not null"`
}

func (Mapping) TableName

func (Mapping) TableName() string

func (Mapping) ToEntity

func (model Mapping) ToEntity() (mappingEntity entity.Mapping, err error)

type MappingSecurityRule added in v0.2.4

type MappingSecurityRule struct {
	ID                             uint64 `gorm:"primaryKey"`
	Name                           string `gorm:"not null"`
	Description                    *string
	AllowedIps                     []string `gorm:"serializer:json"`
	BlockedIps                     []string `gorm:"serializer:json"`
	RpsSoftLimitPerIp              *uint
	RpsHardLimitPerIp              *uint
	ResponseCodeOnMaxRequests      *uint
	MaxConnectionsPerIp            *uint
	BandwidthBpsLimitPerConnection *uint64
	BandwidthLimitOnlyAfterBytes   *uint64
	ResponseCodeOnMaxConnections   *uint
	CreatedAt                      time.Time `gorm:"not null"`
	UpdatedAt                      time.Time `gorm:"not null"`
}

func (MappingSecurityRule) InitialEntries added in v0.2.4

func (MappingSecurityRule) InitialEntries() (initialEntries []interface{}, err error)

func (MappingSecurityRule) TableName added in v0.2.4

func (MappingSecurityRule) TableName() string

func (MappingSecurityRule) ToEntity added in v0.2.4

func (model MappingSecurityRule) ToEntity() (ruleEntity entity.MappingSecurityRule, err error)

func (MappingSecurityRule) ToModel added in v0.2.4

type MarketplaceInstalledItem

type MarketplaceInstalledItem struct {
	ID               uint16 `gorm:"primaryKey"`
	Name             string `gorm:"not null"`
	Hostname         string `gorm:"not null"`
	Type             string `gorm:"not null"`
	UrlPath          string `gorm:"not null"`
	InstallDirectory string `gorm:"not null"`
	InstallUuid      string `gorm:"not null"`
	Services         string
	Mappings         []Mapping
	AvatarUrl        string    `gorm:"not null"`
	Slug             string    `gorm:"not null"`
	CreatedAt        time.Time `gorm:"not null"`
	UpdatedAt        time.Time `gorm:"not null"`
}

func (MarketplaceInstalledItem) TableName

func (MarketplaceInstalledItem) TableName() string

func (MarketplaceInstalledItem) ToEntity

type ScheduledTask

type ScheduledTask struct {
	ID          uint64 `gorm:"primaryKey"`
	Name        string `gorm:"not null"`
	Status      string `gorm:"not null,index"`
	Command     string `gorm:"not null"`
	Tags        []ScheduledTaskTag
	TimeoutSecs *uint16
	RunAt       *time.Time
	Output      *string
	Error       *string
	StartedAt   *time.Time
	FinishedAt  *time.Time
	ElapsedSecs *uint32
	CreatedAt   time.Time `gorm:"not null"`
	UpdatedAt   time.Time `gorm:"not null"`
}

func NewScheduledTask

func NewScheduledTask(
	id uint64,
	name, status, command string,
	tags []ScheduledTaskTag,
	timeoutSecs *uint16,
	runAt *time.Time,
	output, err *string,
	startedAt, finishedAt *time.Time,
	elapsedSecs *uint32,
) ScheduledTask

func (ScheduledTask) TableName

func (ScheduledTask) TableName() string

func (ScheduledTask) ToEntity

func (model ScheduledTask) ToEntity() (taskEntity entity.ScheduledTask, err error)

type ScheduledTaskTag

type ScheduledTaskTag struct {
	ID              uint64 `gorm:"primaryKey"`
	Tag             string `gorm:"not null"`
	ScheduledTaskID uint64 `gorm:"not null"`
}

func (ScheduledTaskTag) TableName

func (ScheduledTaskTag) TableName() string

type SecureAccessPublicKey added in v0.1.7

type SecureAccessPublicKey struct {
	ID        uint16 `gorm:"primaryKey"`
	AccountID uint64 `gorm:"not null"`
	Name      string `gorm:"not null"`
	Content   string `gorm:"not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func NewSecureAccessPublicKey added in v0.1.7

func NewSecureAccessPublicKey(
	id uint16,
	accountId uint64,
	name, content string,
) SecureAccessPublicKey

func (SecureAccessPublicKey) TableName added in v0.1.7

func (SecureAccessPublicKey) TableName() string

func (SecureAccessPublicKey) ToEntity added in v0.1.7

func (model SecureAccessPublicKey) ToEntity() (
	secureAccessPublicKeyEntity entity.SecureAccessPublicKey, err error,
)

type VirtualHost

type VirtualHost struct {
	Hostname       string        `gorm:"primaryKey"`
	Type           string        `gorm:"not null"`
	RootDirectory  string        `gorm:"not null"`
	ParentHostname *string       `gorm:"index"`
	IsPrimary      bool          `gorm:"not null;default:false"`
	IsWildcard     bool          `gorm:"not null;default:false"`
	Aliases        []VirtualHost `gorm:"foreignKey:ParentHostname"`
	CreatedAt      time.Time     `gorm:"not null"`
	UpdatedAt      time.Time     `gorm:"not null"`
}

func (VirtualHost) InitialEntries

func (model VirtualHost) InitialEntries() (entries []interface{}, err error)

func (VirtualHost) ToEntity

func (model VirtualHost) ToEntity() (vhost entity.VirtualHost, err error)

Jump to

Keyboard shortcuts

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