Documentation
¶
Index ¶
- Constants
- Variables
- func LogSecurityRecord(sec RecordSecurity) error
- func LogSecurityRecordWithOptions(sec RecordSecurity, doValidate bool) error
- type ADBAdapterBase
- type Adapter
- type AdapterName
- type AdapterNames
- type AdapterType
- type AdapterTypes
- type Conn
- func (c *Conn) DoIgnore() bool
- func (c *Conn) GetAdapter() IAdapter
- func (c *Conn) GetId() ConnId
- func (c *Conn) GetIsBootstrap() bool
- func (c *Conn) GetIsRequired() bool
- func (c *Conn) Test() (bool, TestStatus, error)
- func (c *Conn) TestBootstrap() (bool, TestStatus, error)
- func (c *Conn) TestRequired() (bool, TestStatus, error)
- func (c *Conn) UnmarshalJSON(data []byte) error
- func (c *Conn) Validate() error
- type ConnActionMap
- type ConnActionType
- type ConnActionTypes
- func (csas ConnActionTypes) Find(csa ConnActionType) ConnActionType
- func (csas ConnActionTypes) HasKey(s ConnActionType) bool
- func (csas ConnActionTypes) IsEmpty() bool
- func (csas ConnActionTypes) Matches(s string) bool
- func (csas ConnActionTypes) String() string
- func (csas ConnActionTypes) ToStringArray() []string
- type ConnId
- func (sid *ConnId) FromString(input string) error
- func (sid ConnId) HasMatch(target ConnId) bool
- func (sid ConnId) IsNil() bool
- func (sid ConnId) MarshalJSON() ([]byte, error)
- func (sid ConnId) MarshalText() ([]byte, error)
- func (sid ConnId) MatchesOne(targets ...ConnId) bool
- func (sid ConnId) String() string
- func (sid *ConnId) UnmarshalJSON(data []byte) error
- func (sid *ConnId) UnmarshalText(text []byte) error
- type ConnIds
- func (sids ConnIds) Append(id ConnId, allowDuplicates bool) ConnIds
- func (sids ConnIds) Clean() ConnIds
- func (sids ConnIds) Contains(sid ConnId) bool
- func (sids ConnIds) Filter(predicate func(ConnId) bool) ConnIds
- func (sids ConnIds) IsValid(targets ...ConnId) bool
- func (sids ConnIds) Merge(other ConnIds) ConnIds
- func (sids ConnIds) Remove(target ConnId) ConnIds
- type ConnSystemHelper
- func (sb *ConnSystemHelper) GetAction() ConnActionType
- func (sb *ConnSystemHelper) GetFromVersion() semver.Version
- func (sb *ConnSystemHelper) GetMap() ConnActionMap
- func (sb *ConnSystemHelper) GetToVersion() semver.Version
- func (sb *ConnSystemHelper) HasFromVersion() bool
- func (sb *ConnSystemHelper) HasToVersion() bool
- func (sb *ConnSystemHelper) IsCreate() bool
- func (sb *ConnSystemHelper) IsDelete() bool
- func (sb *ConnSystemHelper) IsDowngrade() bool
- func (sb *ConnSystemHelper) IsUpgrade() bool
- func (sb *ConnSystemHelper) MustGet(action ConnActionType) string
- func (sb *ConnSystemHelper) MustGetByAction() string
- func (sb *ConnSystemHelper) MustGetCreate() string
- func (sb *ConnSystemHelper) MustGetDelete() string
- func (sb *ConnSystemHelper) MustGetDowngrade() string
- func (sb *ConnSystemHelper) MustGetUpgrade() string
- type ConnSystemItem
- type DbColumnName
- type DbColumnNames
- func (cns DbColumnNames) Add(names ...DbColumnName) DbColumnNames
- func (cns DbColumnNames) Ensure(names ...DbColumnName) DbColumnNames
- func (cns DbColumnNames) Find(name DbColumnName) DbColumnName
- func (cns DbColumnNames) Has(name DbColumnName) bool
- func (cns DbColumnNames) Length() int
- func (cns DbColumnNames) Remove(names ...DbColumnName) DbColumnNames
- type IAdapter
- type IAdapterDB
- type IAdapterMap
- type IAdapters
- type IConn
- type IConnMap
- type IConns
- func (conns IConns) FindByAdapterName(name AdapterName) (IAdapter, bool)
- func (conns IConns) FindByConnId(id ConnId) (IConn, bool)
- func (conns IConns) FindConnByAdapterName(name AdapterName) (IConn, bool)
- func (conns IConns) Get(id ConnId) (IConn, bool)
- func (conns IConns) GetConnCounts() (cTotal int, cIgnore int, cBootstrap int, cIsRequired int)
- func (conns *IConns) Remove(id ConnId)
- func (conns *IConns) Set(conn IConn)
- func (conns IConns) ToAdapterArray() IAdapters
- func (conns IConns) ToAdapterMap() IAdapterMap
- func (conns IConns) ToMap() IConnMap
- func (conns *IConns) UnmarshalJSON(data []byte) error
- type IImportRecordWrapper
- type IRecordAction
- type IRecordModel
- type ISBAdapter
- type ISBAdapterHelper
- type ISBAdapterSql
- type ISBAdapterSqlMap
- type ISBAdapterSqlRows
- type ImportRecordResult
- type ImportRecordResults
- type Manager
- func (m *Manager) FindAdapter(name AdapterName) IAdapter
- func (m *Manager) FindConn(id ConnId) IConn
- func (m *Manager) HasConns() bool
- func (m *Manager) Test(failQuiet bool) error
- func (m *Manager) Validate() error
- func (m *Manager) ValidateBootstrap() error
- func (m *Manager) ValidateRequired() error
- func (m *Manager) ValidateWithOptions(checkIsBootstrap bool, checkIsRequired bool) error
- type RI
- func NewRI(connId ConnId) *RI
- func NewRIAdapter(adapterName AdapterName) *RI
- func NewRISEC(connId ConnId, user auser.RecordUserIdentity) *RI
- func NewRISECAdapter(adapterName AdapterName, user auser.RecordUserIdentity) *RI
- func NewRIWithOptions(connId ConnId, adapterName AdapterName, user auser.RecordUserIdentity, ...) *RI
- func (ri *RI) GetAdapterName() AdapterName
- func (ri *RI) GetConnId() ConnId
- func (ri *RI) GetEvent() string
- func (ri *RI) GetRecordSecurity(action RecordActionType, target *RecordSecurity) (*RecordSecurity, error)
- func (ri *RI) GetUser() auser.RecordUserIdentity
- func (ri *RI) NewRI() *RI
- func (ri *RI) NewRISEC() *RI
- func (ri *RI) NewRISECUser(user auser.RecordUserIdentity) *RI
- func (ri *RI) SetNoApplyHistory(noApplyHistory bool)
- func (ri *RI) SetRecordSecurity(sec *RecordSecurity)
- type RecImportOnExistsType
- type RecordActionType
- type RecordIdentifierMeta
- type RecordIdentifierMetas
- func (rids RecordIdentifierMetas) Filter(predicate func(label *RecordIdentifierMeta) bool) RecordIdentifierMetas
- func (rids RecordIdentifierMetas) FindById(id string) *RecordIdentifierMeta
- func (rids RecordIdentifierMetas) FindByType(recIdType RecordIdentifierType) *RecordIdentifierMeta
- func (rids RecordIdentifierMetas) FindByTypeAndId(recIdType RecordIdentifierType, id string) *RecordIdentifierMeta
- func (rids RecordIdentifierMetas) FindExactMatch(target *RecordIdentifierMeta) *RecordIdentifierMeta
- func (rids RecordIdentifierMetas) FindWithMatchingOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) *RecordIdentifierMeta
- func (rids RecordIdentifierMetas) HasExactMatch(target *RecordIdentifierMeta) bool
- func (rids RecordIdentifierMetas) HasMatch(targets ...*RecordIdentifierMeta) bool
- func (rids RecordIdentifierMetas) HasMatchByTypeId(recIdType RecordIdentifierType, id string) bool
- func (rids RecordIdentifierMetas) HasMatchByTypeIdByType(recIdType RecordIdentifierType, id string) bool
- func (rids RecordIdentifierMetas) HasMatchByTypeOnly(recIdType RecordIdentifierType) bool
- func (rids RecordIdentifierMetas) HasMatchWithOptions(target *RecordIdentifierMeta, matchByLabel bool) bool
- func (rids RecordIdentifierMetas) RemoveById(id string) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) RemoveByType(recIdType RecordIdentifierType) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) RemoveByTypeAndId(recIdType RecordIdentifierType, id string) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) RemoveExact(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) RemoveWithOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) Set(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) SetById(id string) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) SetByType(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) SetByTypeAndId(recIdType RecordIdentifierType, id string) (RecordIdentifierMetas, error)
- func (rids RecordIdentifierMetas) SetWithOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) (RecordIdentifierMetas, error)
- type RecordIdentifierType
- type RecordIdentifierTypes
- type RecordSecurity
- type RecordSecurityHistoryTime
- type RecordSecurityHistoryTimes
- func (rsh *RecordSecurityHistoryTimes) AddEntry(user auser.RecordUserIdentity, action RecordActionType, event string, ...)
- func (rsh RecordSecurityHistoryTimes) FilterByAction(action RecordActionType) RecordSecurityHistoryTimes
- func (rsh RecordSecurityHistoryTimes) FindEntriesByUser(user auser.RecordUserIdentity) []*RecordSecurityHistoryTime
- func (rsh RecordSecurityHistoryTimes) LatestEntry() *RecordSecurityHistoryTime
- type SBAdapterSql
- func (sba *SBAdapterSql) GetHost() string
- func (sba *SBAdapterSql) GetName() AdapterName
- func (sba *SBAdapterSql) GetType() AdapterType
- func (sba *SBAdapterSql) Query(query string) (ISBAdapterSqlRows, error)
- func (sba *SBAdapterSql) QueryArgs(query string, args ...interface{}) (result ISBAdapterSqlRows, err error)
- func (sba *SBAdapterSql) QueryModel(query string, model interface{}) error
- func (sba *SBAdapterSql) QueryModelArgs(query string, model interface{}, args ...interface{}) error
- func (sba *SBAdapterSql) SupportsModels() bool
- type SBAdapterSqlRows
- func (rows *SBAdapterSqlRows) Close() (err error)
- func (rows *SBAdapterSqlRows) EndTimer() time.Duration
- func (rows *SBAdapterSqlRows) GetTimerDuration() time.Duration
- func (rows *SBAdapterSqlRows) Next() bool
- func (rows *SBAdapterSqlRows) Scan(dest ...any) (err error)
- func (rows *SBAdapterSqlRows) StartTimer()
- type TestStatus
Constants ¶
const (
LOGGER_SECURITYRECORD alog.ChannelLabel = "secrec" // Security Record Channel
)
const TYPEMANAGER_CONNADAPTERS = "connadapters"
Variables ¶
var ErrDatabaseIsEmpty = errors.New("database is empty")
var ErrHostIsEmpty = errors.New("host is empty")
var ErrNoPK = fmt.Errorf("no primary key")
var ErrPasswordIsEmpty = errors.New("password is empty")
var ErrUsernameIsEmpty = errors.New("username is empty")
Functions ¶
func LogSecurityRecord ¶
func LogSecurityRecord(sec RecordSecurity) error
func LogSecurityRecordWithOptions ¶
func LogSecurityRecordWithOptions(sec RecordSecurity, doValidate bool) error
Types ¶
type ADBAdapterBase ¶
type ADBAdapterBase struct {
Adapter
Database string `json:"database,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
PasswordFile string `json:"passwordFile,omitempty"` // Loaded once then deleted when the password is populated.
// contains filtered or unexported fields
}
ADBAdapterBase holds the basic database connection information.
func (*ADBAdapterBase) GetDatabase ¶
func (cn *ADBAdapterBase) GetDatabase() string
GetDatabase returns the database name of the database connection.
func (*ADBAdapterBase) GetPassword ¶
func (cn *ADBAdapterBase) GetPassword() string
GetPassword returns the password of the database connection.
func (*ADBAdapterBase) GetUsername ¶
func (cn *ADBAdapterBase) GetUsername() string
GetUsername returns the username of the database connection.
func (*ADBAdapterBase) Test ¶
func (cn *ADBAdapterBase) Test() (bool, TestStatus, error)
Test attempts to validate the ADBAdapterBase and returns the test status and error if any.
func (*ADBAdapterBase) Validate ¶
func (cn *ADBAdapterBase) Validate() error
Validate checks if the ADBAdapterBase object is valid.
type Adapter ¶
type Adapter struct {
Type AdapterType `json:"type,omitempty"`
Name AdapterName `json:"name,omitempty"`
//Network string `json:"network,omitempty"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
// contains filtered or unexported fields
}
Adapter satisfies IAdapter. Use it to compose connector structs.
func (*Adapter) GetName ¶
func (a *Adapter) GetName() AdapterName
GetName returns the AdapterName of the Adapter.
func (*Adapter) GetType ¶
func (a *Adapter) GetType() AdapterType
GetType returns the AdapterType of the Adapter.
type AdapterName ¶
type AdapterName string
AdapterName represents an adapter name
func (AdapterName) IsEmpty ¶
func (an AdapterName) IsEmpty() bool
IsEmpty checks if the AdapterName is empty
func (AdapterName) Matches ¶
func (an AdapterName) Matches(s string) bool
Matches checks if the AdapterName matches the given string
func (AdapterName) String ¶
func (an AdapterName) String() string
String returns the string representation of the AdapterName
func (AdapterName) TrimSpace ¶
func (an AdapterName) TrimSpace() AdapterName
TrimSpace returns the trimmed string representation of the AdapterName
type AdapterNames ¶
type AdapterNames []AdapterName
AdapterNames represents a slice of AdapterName
func (AdapterNames) Find ¶
func (ans AdapterNames) Find(an AdapterName) AdapterName
Find returns the AdapterName if found, otherwise an empty AdapterName
func (AdapterNames) HasKey ¶
func (ans AdapterNames) HasKey(s AdapterName) bool
HasKey checks if the AdapterNames slice contains the given AdapterName
func (AdapterNames) IsEmpty ¶
func (ans AdapterNames) IsEmpty() bool
IsEmpty checks if the AdapterNames slice is empty
func (AdapterNames) Matches ¶
func (ans AdapterNames) Matches(s string) bool
Matches checks if any AdapterName in the AdapterNames slice matches the given string
func (AdapterNames) String ¶
func (ans AdapterNames) String() string
String returns the string representation of the AdapterNames slice
func (AdapterNames) ToStringArray ¶
func (ans AdapterNames) ToStringArray() []string
ToStringArray returns an array of AdapterNames as strings
type AdapterType ¶
type AdapterType string
AdapterType represents an adapter type
func (AdapterType) IsEmpty ¶
func (at AdapterType) IsEmpty() bool
IsEmpty checks if the AdapterType is empty
func (AdapterType) Matches ¶
func (at AdapterType) Matches(s string) bool
Matches checks if the AdapterType matches the given string
func (AdapterType) String ¶
func (at AdapterType) String() string
String returns the string representation of the AdapterType
func (AdapterType) ToStringTrimLower ¶
func (at AdapterType) ToStringTrimLower() string
ToStringTrimLower returns the trimmed and lowercased string representation of the AdapterType
func (AdapterType) TrimSpace ¶
func (at AdapterType) TrimSpace() AdapterType
TrimSpace returns the trimmed string representation of the AdapterType
func (AdapterType) Validate ¶
func (at AdapterType) Validate() error
Validate checks if the AdapterType is valid
type AdapterTypes ¶
type AdapterTypes []AdapterType
AdapterTypes represents a slice of AdapterType
func (AdapterTypes) Find ¶
func (ats AdapterTypes) Find(at AdapterType) AdapterType
Find returns the AdapterType if found, otherwise an empty AdapterType
func (AdapterTypes) HasKey ¶
func (ats AdapterTypes) HasKey(s AdapterType) bool
HasKey checks if the AdapterTypes slice contains the given AdapterType
func (AdapterTypes) IsEmpty ¶
func (ats AdapterTypes) IsEmpty() bool
IsEmpty checks if the AdapterTypes slice is empty
func (AdapterTypes) Matches ¶
func (ats AdapterTypes) Matches(s string) bool
Matches checks if any AdapterType in the AdapterTypes slice matches the given string
func (AdapterTypes) String ¶
func (ats AdapterTypes) String() string
String returns the string representation of the AdapterTypes slice
func (AdapterTypes) ToStringArray ¶
func (ats AdapterTypes) ToStringArray() []string
ToStringArray returns an array of AdapterTypes as strings
type Conn ¶
type Conn struct {
Ignore bool `json:"ignore,omitempty"` // Ignore flag for the connection.
Id ConnId `json:"id,omitempty"` // Unique identifier for the connection.
Description string `json:"description,omitempty"` // Optional description for the connection.
Adapter IAdapter `json:"adapter,omitempty"` // Adapter associated with the connection.
// Optional
IsRequired bool `json:"isRequired,omitempty"` // If true, then this adapter is required.
IsBootstrap bool `json:"isBootstrap,omitempty"` // If true, then this adapter is required during boot.
// contains filtered or unexported fields
}
Conn struct represents a connection with an adapter.
func (*Conn) GetAdapter ¶
GetAdapter returns the Adapter of the connection.
func (*Conn) GetIsBootstrap ¶
GetIsBootstrap returns the IsBootstrap flag of the connection.
func (*Conn) GetIsRequired ¶
GetIsRequired returns the IsRequired flag of the connection.
func (*Conn) Test ¶
func (c *Conn) Test() (bool, TestStatus, error)
Test attempts to establish the connection and handles failures based on IsRequired and IsBootstrap flags.
func (*Conn) TestBootstrap ¶
func (c *Conn) TestBootstrap() (bool, TestStatus, error)
TestBootstrap attempts to establish the connection if it is marked as bootstrap.
func (*Conn) TestRequired ¶
func (c *Conn) TestRequired() (bool, TestStatus, error)
TestRequired attempts to establish the connection if it is marked as required.
func (*Conn) UnmarshalJSON ¶
UnmarshalJSON is a custom unmarshaller for Conn that handles IAdapter. It unmarshals the JSON data into the Conn struct and its Adapter.
type ConnActionMap ¶
type ConnActionMap map[ConnActionType]*ConnSystemItem
ConnActionMap is a map of ConnActionType to ConnSystemItem.
func NewConnActionMap ¶
func NewConnActionMap() ConnActionMap
NewConnActionMap creates a new ConnActionMap with default ConnSystemItems.
func (ConnActionMap) GetItem ¶
func (cvm ConnActionMap) GetItem(cvType ConnActionType) *ConnSystemItem
GetItem returns the ConnSystemItem for the given ConnActionType, or nil if it does not exist.
func (ConnActionMap) HasSqlText ¶
func (cvm ConnActionMap) HasSqlText(cvType ConnActionType) bool
HasSqlText checks if the ConnSystemItem for the given ConnActionType has non-empty text.
func (ConnActionMap) MustGetItem ¶
func (cvm ConnActionMap) MustGetItem(cvType ConnActionType) *ConnSystemItem
MustGetItem returns the ConnSystemItem for the given ConnActionType, creating a new one if it does not exist.
func (ConnActionMap) Validate ¶
func (cvm ConnActionMap) Validate() error
Validate checks if the ConnActionMap is valid.
type ConnActionType ¶
type ConnActionType string
ConnActionType represents an adapter type.
const ( CONNACTIONTYPE_CREATE ConnActionType = "CREATE" CONNACTIONTYPE_UPGRADE ConnActionType = "UPGRADE" CONNACTIONTYPE_DOWNGRADE ConnActionType = "DOWNGRADE" CONNACTIONTYPE_DELETE ConnActionType = "DELETE" CONNACTIONTYPE_NOOP_EQUAL ConnActionType = "no-op-equal" // expect no-operation to be performed because DB is in an equal state )
func (ConnActionType) IsEmpty ¶
func (csa ConnActionType) IsEmpty() bool
IsEmpty checks if the ConnActionType is empty.
func (ConnActionType) Matches ¶
func (csa ConnActionType) Matches(s string) bool
Matches checks if the ConnActionType matches the given string.
func (ConnActionType) String ¶
func (csa ConnActionType) String() string
String returns the string representation of the ConnActionType.
func (ConnActionType) ToStringTrimLower ¶
func (csa ConnActionType) ToStringTrimLower() string
ToStringTrimLower returns the trimmed and lowercased string representation of the ConnActionType.
func (ConnActionType) TrimSpace ¶
func (csa ConnActionType) TrimSpace() ConnActionType
TrimSpace returns the trimmed string representation of the ConnActionType.
func (ConnActionType) Validate ¶
func (csa ConnActionType) Validate() error
Validate checks if the ConnActionType is valid.
type ConnActionTypes ¶
type ConnActionTypes []ConnActionType
ConnActionTypes represents a slice of ConnActionType.
func (ConnActionTypes) Find ¶
func (csas ConnActionTypes) Find(csa ConnActionType) ConnActionType
Find returns the ConnActionType if found, otherwise an empty ConnActionType.
func (ConnActionTypes) HasKey ¶
func (csas ConnActionTypes) HasKey(s ConnActionType) bool
HasKey checks if the ConnActionTypes slice contains the given ConnActionType.
func (ConnActionTypes) IsEmpty ¶
func (csas ConnActionTypes) IsEmpty() bool
IsEmpty checks if the ConnActionTypes slice is empty.
func (ConnActionTypes) Matches ¶
func (csas ConnActionTypes) Matches(s string) bool
Matches checks if any ConnActionType in the ConnActionTypes slice matches the given string.
func (ConnActionTypes) String ¶
func (csas ConnActionTypes) String() string
String returns the string representation of the ConnActionTypes slice.
func (ConnActionTypes) ToStringArray ¶
func (csas ConnActionTypes) ToStringArray() []string
ToStringArray returns an array of ConnActionTypes as strings.
type ConnId ¶
ConnId represents a unique service identifier.
func NewConnId ¶
func NewConnId() ConnId
NewConnId creates a new ConnId with a non-nil value using NewNullUUIDWithValue.
func ParseConnId ¶
ParseConnId parses a string into a ConnId using ParseNullUUID.
func ToConnIdFromUUID ¶
ToConnIdFromUUID creates a new UID with a non-nil value using NewNullUUIDWithValue.
func (*ConnId) FromString ¶
FromString parses a string and assigns the ConnId to itself.
func (ConnId) MarshalJSON ¶
MarshalJSON ensures that nil ConnIds are marshaled as null.
func (ConnId) MarshalText ¶
MarshalText converts the ConnId to its string representation for text-based encoding.
func (ConnId) MatchesOne ¶
MatchesOne checks if the ConnId matches any of the provided ConnIds.
func (*ConnId) UnmarshalJSON ¶
UnmarshalJSON parses a ConnId from a JSON string, handling "null" or empty values.
func (*ConnId) UnmarshalText ¶
UnmarshalText parses a ConnId from a plain text string.
type ConnIds ¶
type ConnIds []ConnId
ConnIds represents a collection of ConnId values.
func (ConnIds) Append ¶
Append adds a ConnId to the slice. Optionally prevents duplicates if allowDuplicates is false.
func (ConnIds) Filter ¶
Filter creates a new slice containing only ConnIds that match the given predicate.
type ConnSystemHelper ¶
type ConnSystemHelper struct {
ActionMap ConnActionMap `json:"actionMap"`
Action ConnActionType `json:"action"`
FromVersion *semver.Version `json:"fromVersion,omitempty"`
ToVersion *semver.Version `json:"toVersion,omitempty"`
}
func (*ConnSystemHelper) GetAction ¶
func (sb *ConnSystemHelper) GetAction() ConnActionType
func (*ConnSystemHelper) GetFromVersion ¶
func (sb *ConnSystemHelper) GetFromVersion() semver.Version
func (*ConnSystemHelper) GetMap ¶
func (sb *ConnSystemHelper) GetMap() ConnActionMap
func (*ConnSystemHelper) GetToVersion ¶
func (sb *ConnSystemHelper) GetToVersion() semver.Version
func (*ConnSystemHelper) HasFromVersion ¶
func (sb *ConnSystemHelper) HasFromVersion() bool
func (*ConnSystemHelper) HasToVersion ¶
func (sb *ConnSystemHelper) HasToVersion() bool
func (*ConnSystemHelper) IsCreate ¶
func (sb *ConnSystemHelper) IsCreate() bool
func (*ConnSystemHelper) IsDelete ¶
func (sb *ConnSystemHelper) IsDelete() bool
func (*ConnSystemHelper) IsDowngrade ¶
func (sb *ConnSystemHelper) IsDowngrade() bool
func (*ConnSystemHelper) IsUpgrade ¶
func (sb *ConnSystemHelper) IsUpgrade() bool
func (*ConnSystemHelper) MustGet ¶
func (sb *ConnSystemHelper) MustGet(action ConnActionType) string
func (*ConnSystemHelper) MustGetByAction ¶
func (sb *ConnSystemHelper) MustGetByAction() string
func (*ConnSystemHelper) MustGetCreate ¶
func (sb *ConnSystemHelper) MustGetCreate() string
func (*ConnSystemHelper) MustGetDelete ¶
func (sb *ConnSystemHelper) MustGetDelete() string
func (*ConnSystemHelper) MustGetDowngrade ¶
func (sb *ConnSystemHelper) MustGetDowngrade() string
func (*ConnSystemHelper) MustGetUpgrade ¶
func (sb *ConnSystemHelper) MustGetUpgrade() string
type ConnSystemItem ¶
type ConnSystemItem struct {
DoSkip bool `json:"doSkip,omitempty"` // Flag to indicate if the item should be skipped.
Text string `json:"text,omitempty"` // Text content of the item.
// contains filtered or unexported fields
}
ConnSystemItem represents an item with versioning information.
func (*ConnSystemItem) UnpackImportWithMacroDirective ¶
func (cvi *ConnSystemItem) UnpackImportWithMacroDirective(dirOptions string) error
UnpackImportWithMacroDirective processes the macro directive for importing content. If the text begins with "#igorg-do-import:", it reads the content from the specified file path.
func (*ConnSystemItem) Validate ¶
func (cvi *ConnSystemItem) Validate() error
Validate checks if the ConnSystemItem is valid.
type DbColumnName ¶
type DbColumnName string
DbColumnName is a type that represents a database column name.
func (DbColumnName) Bytes ¶
func (cn DbColumnName) Bytes() []byte
Bytes converts the DbColumnName to a slice of bytes.
func (DbColumnName) IsEmpty ¶
func (cn DbColumnName) IsEmpty() bool
IsEmpty checks if the DbColumnName is empty after trimming whitespace.
func (DbColumnName) String ¶
func (cn DbColumnName) String() string
String converts the DbColumnName to a regular string.
func (DbColumnName) TrimSpace ¶
func (cn DbColumnName) TrimSpace() DbColumnName
TrimSpace returns a new DbColumnName with leading and trailing whitespace removed.
type DbColumnNames ¶
type DbColumnNames []DbColumnName
DbColumnNames is a slice of DbColumnName that represents a list of database column names.
func NewDbColumnNames ¶
func NewDbColumnNames(names ...DbColumnName) DbColumnNames
NewDbColumnNames creates a new DbColumnNames slice from a variadic list of DbColumnName.
func (DbColumnNames) Add ¶
func (cns DbColumnNames) Add(names ...DbColumnName) DbColumnNames
Add appends non-duplicate DbColumnNames to the slice.
func (DbColumnNames) Ensure ¶
func (cns DbColumnNames) Ensure(names ...DbColumnName) DbColumnNames
Ensure ensures that the given DbColumnNames are present in the slice. It's an alias for the Add method for better readability.
func (DbColumnNames) Find ¶
func (cns DbColumnNames) Find(name DbColumnName) DbColumnName
Find searches for a DbColumnName in the slice and returns it if found.
func (DbColumnNames) Has ¶
func (cns DbColumnNames) Has(name DbColumnName) bool
Has checks if a DbColumnName exists in the slice.
func (DbColumnNames) Length ¶
func (cns DbColumnNames) Length() int
Length returns the number of DbColumnName in the slice.
func (DbColumnNames) Remove ¶
func (cns DbColumnNames) Remove(names ...DbColumnName) DbColumnNames
Remove deletes the specified DbColumnNames from the slice.
type IAdapter ¶
type IAdapter interface {
GetType() AdapterType
GetName() AdapterName
GetHost() string
GetPort() int
Validate() error
Test() (ok bool, testStatus TestStatus, err error)
}
IAdapter interface defines the methods that an adapter should implement.
type IAdapterDB ¶
type IAdapterDB interface {
IAdapter
GetDatabase() string
GetUsername() string
GetPassword() string
Validate() error
Test() (bool, TestStatus, error)
}
IAdapterDB interface extends IAdapter with additional database-related methods.
type IAdapterMap ¶
type IAdapterMap map[AdapterName]IAdapter
IAdapterMap is a map of IAdapter with AdapterName as the key.
func (IAdapterMap) Get ¶
func (m IAdapterMap) Get(name AdapterName) (IAdapter, bool)
Get retrieves an IAdapter by its AdapterName.
func (IAdapterMap) Remove ¶
func (m IAdapterMap) Remove(name AdapterName)
Remove deletes an IAdapter from the map by its AdapterName.
func (IAdapterMap) Set ¶
func (m IAdapterMap) Set(name AdapterName, adapter IAdapter)
Set adds or updates an IAdapter in the map.
func (IAdapterMap) ToArray ¶
func (m IAdapterMap) ToArray() IAdapters
ToArray converts the IAdapterMap to an array of IAdapters.
type IAdapters ¶
type IAdapters []IAdapter
IAdapters is a slice of IAdapter.
func (IAdapters) ToMap ¶
func (adapters IAdapters) ToMap() IAdapterMap
ToMap converts the IAdapters to an IAdapterMap.
type IConn ¶
type IConn interface {
DoIgnore() bool
GetId() ConnId
GetAdapter() IAdapter
GetIsRequired() bool
GetIsBootstrap() bool
Validate() error
}
IConn interface defines the methods that a connection should implement.
type IConnMap ¶
IConnMap is a map of IConn with UUID as the key.
func (IConnMap) ToAdapterArray ¶
ToAdapterArray converts the IConnMap to an array of IAdapters.
func (IConnMap) ToAdapterMap ¶
func (m IConnMap) ToAdapterMap() IAdapterMap
ToAdapterMap converts the IConnMap to an IAdapterMap.
type IConns ¶
type IConns []IConn
func (IConns) FindByAdapterName ¶
func (conns IConns) FindByAdapterName(name AdapterName) (IAdapter, bool)
FindByAdapterName finds an IAdapter by its name.
func (IConns) FindByConnId ¶
FindByConnId finds an IConn by its UUID.
func (IConns) FindConnByAdapterName ¶
func (conns IConns) FindConnByAdapterName(name AdapterName) (IConn, bool)
FindConnByAdapterName finds an IConn by the adapter name.
func (IConns) GetConnCounts ¶
func (IConns) ToAdapterArray ¶
ToAdapterArray converts the IConns to an array of IAdapters.
func (IConns) ToAdapterMap ¶
func (conns IConns) ToAdapterMap() IAdapterMap
ToAdapterMap converts the IConns to an IAdapterMap.
func (*IConns) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into a slice of Conn structs.
type IImportRecordWrapper ¶
type IImportRecordWrapper interface {
GetDirImports() string
GetRecImportOnExistsType() RecImportOnExistsType
GetModifiedDate() time.Time
GetTag(key atags.TagKey) *atags.TagKeyValueString
}
type IRecordAction ¶
type IRecordAction interface {
// Import is required for imports to work.
// Notice the function returns "ImportRecordResults". This must
// be true for a single object or for an array of objects.
// Why? When the object is created from model type in the import
// function, the same "Import" function is run regardless if the
// object is a single object or an array of objects. The array of
// objects would normally and naturally return "ImportRecordResults"
// but a single object would naturually return a single "ImportRecordResult".
// Although the implementation is counter-intuitive, it makes sense
// from a single interface implementation since both a single object
// and array of objects are treated the same.
Import(ri *RI, irw IImportRecordWrapper) (ImportRecordResults, error)
}
type IRecordModel ¶
type IRecordModel interface {
IRecordAction
Insert(ri *RI) error
Update(ri *RI) error
Upsert(ri *RI) error
Select(ri *RI) error
SelectIntoNewObject(ri *RI) (IRecordModel, error)
GetRecordSecurity() RecordSecurity
GetPrimaryKeyAsString() string
}
IRecordModel is used to reduce "mostly" repeatable code within object models-tenants. An example can be found when inheriting pg/pg-model-base.go and running OnImportRunAction
type ISBAdapter ¶
type ISBAdapter interface {
GetType() AdapterType
GetName() AdapterName
GetHost() string
}
ISBAdapter interface defines the sandboxed interface implementation of IAdapter.
type ISBAdapterHelper ¶
type ISBAdapterHelper interface {
GetMap() ConnSystemHelper
CheckVersionState() ConnActionType
IsCreate() bool
IsUpgrade() bool
IsDowngrade() bool
IsDelete() bool
HasFromVersion() bool
HasToVersion() bool
GetFromVersion() semver.Version
GetToVersion() semver.Version
MustGetByAction() string
MustGetCreate() string
MustGetUpgrade() string
MustGetDowngrade() string
MustGetDelete() string
MustGet(action ConnActionType) string
}
type ISBAdapterSql ¶
type ISBAdapterSql interface {
ISBAdapter
// SupportsModels returns 'true' if Model(s) are supported,
// otherwise use Query to return a RowScanner.
SupportsModels() bool
// Query operates similar to "database/sql".
Query(query string) (ISBAdapterSqlRows, error)
QueryArgs(query string, args ...interface{}) (ISBAdapterSqlRows, error)
// QueryModel operates similar to "github.com/uptrace/bun".
QueryModel(query string, model interface{}) error
QueryModelArgs(query string, model interface{}, args ...interface{}) error
}
ISBAdapterSql is for sandboxed adapters with SQL capability.
type ISBAdapterSqlMap ¶
type ISBAdapterSqlMap interface {
ISBAdapterSql
// RunCommand runs an exe command against the data source.
RunCommand(text string) error
RunMapByAction() error
RunMapAction(action ConnActionType) error
GetAdapterHelper() ISBAdapterHelper
}
ISBAdapterSqlMap is for aconns with sql capability and added mapping component to predefined sql.
type ISBAdapterSqlRows ¶
type ISBAdapterSqlRows interface {
StartTimer()
EndTimer() time.Duration
GetTimerDuration() time.Duration
Next() bool
Close() error
Scan(dest ...any) error
}
ISBAdapterSqlRows defines the interface for SQL rows with timing functionality.
type ImportRecordResult ¶
type ImportRecordResults ¶
type ImportRecordResults []*ImportRecordResult
func NewImportRecordResults ¶
func NewImportRecordResults(id string, err error) ImportRecordResults
type Manager ¶
type Manager struct {
Conns IConns `json:"conns,omitempty"`
// In a sandbox situation, set LimitAccess to true, which indicates
// to the manager to only allow operations that can be run safely and
// specifically inside the sandbox.
LimitAccess bool `json:"limitAccess,omitempty"`
}
Manager is used as the basis for interacting with Connections. Use cases can vary. In an SaaS application, consider initializing a single Manager as a global, while any client-specific conns are initialized separately with their own Manager instance. Depending upon your app requirements, you may need to copy and modify this structure to suit your needs. This struct is designed to be compliant for applications that need to run scripts in a sandboxed environment with options to limit client access.
func (*Manager) FindAdapter ¶
func (m *Manager) FindAdapter(name AdapterName) IAdapter
FindAdapter finds an IAdapter by its name.
func (*Manager) Test ¶
Test both validates and opens a connection, testing it. If an adapter uses connection pools, they are initialized here.
func (*Manager) ValidateBootstrap ¶
ValidateBootstrap ensures expected connections can be tried early in a SaaS-style application.
func (*Manager) ValidateRequired ¶
ValidateRequired ensures required connections can be tried during normal boot.
type RI ¶
type RI struct {
// A ConnId or AdapterName is required.
ConnId ConnId
AdapterName AdapterName
// The user identifier to use when created a RecordSecurity for any given action.
// This could be a username, email or id.
User auser.RecordUserIdentity
// If used, the event property describes the reason why the action took place.
// For example, this value is set to "import" for bulk imports.
// It could be made more granular (eg import from /path/to/file)
Event string
// contains filtered or unexported fields
}
RI is the Record Initializer structure.
func NewRIAdapter ¶
func NewRIAdapter(adapterName AdapterName) *RI
func NewRISECAdapter ¶
func NewRISECAdapter(adapterName AdapterName, user auser.RecordUserIdentity) *RI
func NewRIWithOptions ¶
func NewRIWithOptions(connId ConnId, adapterName AdapterName, user auser.RecordUserIdentity, event string) *RI
func (*RI) GetAdapterName ¶
func (ri *RI) GetAdapterName() AdapterName
func (*RI) GetRecordSecurity ¶
func (ri *RI) GetRecordSecurity(action RecordActionType, target *RecordSecurity) (*RecordSecurity, error)
func (*RI) GetUser ¶
func (ri *RI) GetUser() auser.RecordUserIdentity
func (*RI) NewRISECUser ¶
func (ri *RI) NewRISECUser(user auser.RecordUserIdentity) *RI
func (*RI) SetNoApplyHistory ¶
func (*RI) SetRecordSecurity ¶
func (ri *RI) SetRecordSecurity(sec *RecordSecurity)
type RecImportOnExistsType ¶
type RecImportOnExistsType int
const ( REC_IMPORT_ON_EXISTS_IGNORE RecImportOnExistsType = iota REC_IMPORT_ON_EXISTS_UPDATE REC_IMPORT_ON_EXISTS_UPDATE_IF_NEWER )
These values work in conjunction with those on individual records. The logic is as follows:
- Examine the record for a ModifiedTime and RecImportOnExistsType value. a. If the ModifiedTime is valid, then use this one for instructions. b. If the ModifiedTime is invalid, then proceed to 2.
- Use the RecImportOnExistsType value from RecordImport and the ModifiedDate from RecordImportsWrapper to make the import decision. --> a sophisticated program might employ a conflict manager to allow or disallow updates.
type RecordActionType ¶
type RecordActionType string
RecordActionType represents the type of action performed on a database record.
const ( // Actions that typically require a username. REC_ACTION_INSERT RecordActionType = "insert" // Insert a new record. REC_ACTION_UPDATE RecordActionType = "update" // Update an existing record. REC_ACTION_DELETE RecordActionType = "delete" // Delete a record. REC_ACTION_UPSERT RecordActionType = "upsert" // Insert or update a record. // Events that do not require a username. REC_EVENT_IMPORT RecordActionType = "import" // Import records in bulk. REC_EVENT_ADMINFIX RecordActionType = "adminfix" // Administrative fixes to records. )
Constants for RecordActionType values.
func (RecordActionType) IsEmpty ¶
func (rt RecordActionType) IsEmpty() bool
IsEmpty checks if the RecordActionType is empty after trimming whitespace.
func (RecordActionType) String ¶
func (rt RecordActionType) String() string
String converts the RecordActionType to a regular string.
func (RecordActionType) TrimSpace ¶
func (rt RecordActionType) TrimSpace() RecordActionType
TrimSpace returns a new RecordActionType with leading and trailing whitespace removed.
type RecordIdentifierMeta ¶
type RecordIdentifierMeta struct {
Type RecordIdentifierType `json:"type" jsonschema:"type=string,title=Identifier Type,description=The type of identifier,example=Email"`
Id string `json:"id" jsonschema:"type=string,title=Identifier Value,description=The value of the identifier,example=bob@example.com"`
}
RecordIdentifierMeta represents a single identifier for a user.
func NewRecordIdentifierMeta ¶
func NewRecordIdentifierMeta(recIdType RecordIdentifierType, id string) *RecordIdentifierMeta
NewRecordIdentifierMeta creates a new RecordIdentifierMeta instance.
func (*RecordIdentifierMeta) HasMatch ¶
func (rid *RecordIdentifierMeta) HasMatch(other *RecordIdentifierMeta) bool
HasMatch checks if the current RecordIdentifierMeta matches another.
func (*RecordIdentifierMeta) HasMatchWithTypeId ¶
func (rid *RecordIdentifierMeta) HasMatchWithTypeId(recIdType RecordIdentifierType, id string) bool
HasMatchWithTypeId checks if the RecordIdentifierMeta matches a given type and ID.
func (*RecordIdentifierMeta) Validate ¶
func (rid *RecordIdentifierMeta) Validate() error
Validate validates the RecordIdentifierMeta fields.
type RecordIdentifierMetas ¶
type RecordIdentifierMetas []*RecordIdentifierMeta
RecordIdentifierMetas represents a list of RecordIdentifierMeta objects.
func (RecordIdentifierMetas) Filter ¶
func (rids RecordIdentifierMetas) Filter(predicate func(label *RecordIdentifierMeta) bool) RecordIdentifierMetas
Filter filters the RecordIdentifierMetas collection by a custom predicate.
func (RecordIdentifierMetas) FindById ¶
func (rids RecordIdentifierMetas) FindById(id string) *RecordIdentifierMeta
FindById finds a RecordIdentifierMeta strictly by its ID.
func (RecordIdentifierMetas) FindByType ¶
func (rids RecordIdentifierMetas) FindByType(recIdType RecordIdentifierType) *RecordIdentifierMeta
FindByType finds a RecordIdentifierMeta by its Type, ignoring ID.
func (RecordIdentifierMetas) FindByTypeAndId ¶
func (rids RecordIdentifierMetas) FindByTypeAndId(recIdType RecordIdentifierType, id string) *RecordIdentifierMeta
FindByTypeAndId finds a RecordIdentifierMeta by its Type and ID.
func (RecordIdentifierMetas) FindExactMatch ¶
func (rids RecordIdentifierMetas) FindExactMatch(target *RecordIdentifierMeta) *RecordIdentifierMeta
FindExactMatch finds a RecordIdentifierMeta that matches exactly (Type and ID).
func (RecordIdentifierMetas) FindWithMatchingOptions ¶
func (rids RecordIdentifierMetas) FindWithMatchingOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) *RecordIdentifierMeta
FindWithMatchingOptions finds a RecordIdentifierMeta using flexible matching options.
func (RecordIdentifierMetas) HasExactMatch ¶
func (rids RecordIdentifierMetas) HasExactMatch(target *RecordIdentifierMeta) bool
func (RecordIdentifierMetas) HasMatch ¶
func (rids RecordIdentifierMetas) HasMatch(targets ...*RecordIdentifierMeta) bool
func (RecordIdentifierMetas) HasMatchByTypeId ¶
func (rids RecordIdentifierMetas) HasMatchByTypeId(recIdType RecordIdentifierType, id string) bool
func (RecordIdentifierMetas) HasMatchByTypeIdByType ¶
func (rids RecordIdentifierMetas) HasMatchByTypeIdByType(recIdType RecordIdentifierType, id string) bool
func (RecordIdentifierMetas) HasMatchByTypeOnly ¶
func (rids RecordIdentifierMetas) HasMatchByTypeOnly(recIdType RecordIdentifierType) bool
func (RecordIdentifierMetas) HasMatchWithOptions ¶
func (rids RecordIdentifierMetas) HasMatchWithOptions(target *RecordIdentifierMeta, matchByLabel bool) bool
HasMatchWithOptions checks if the RecordIdentifierMetas array contains a match based on flexible criteria.
func (RecordIdentifierMetas) RemoveById ¶
func (rids RecordIdentifierMetas) RemoveById(id string) (RecordIdentifierMetas, error)
RemoveById removes a RecordIdentifierMeta by ID only.
func (RecordIdentifierMetas) RemoveByType ¶
func (rids RecordIdentifierMetas) RemoveByType(recIdType RecordIdentifierType) (RecordIdentifierMetas, error)
RemoveByType removes a RecordIdentifierMeta by Type only.
func (RecordIdentifierMetas) RemoveByTypeAndId ¶
func (rids RecordIdentifierMetas) RemoveByTypeAndId(recIdType RecordIdentifierType, id string) (RecordIdentifierMetas, error)
RemoveByTypeAndId removes a RecordIdentifierMeta by Type and ID.
func (RecordIdentifierMetas) RemoveExact ¶
func (rids RecordIdentifierMetas) RemoveExact(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
RemoveExact removes a RecordIdentifierMeta by exact match (Type and ID).
func (RecordIdentifierMetas) RemoveWithOptions ¶
func (rids RecordIdentifierMetas) RemoveWithOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) (RecordIdentifierMetas, error)
RemoveWithOptions removes a RecordIdentifierMeta with flexible matching options.
func (RecordIdentifierMetas) Set ¶
func (rids RecordIdentifierMetas) Set(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
Set adds or updates a RecordIdentifierMeta without considering type-based or ID-based matching.
func (RecordIdentifierMetas) SetById ¶
func (rids RecordIdentifierMetas) SetById(id string) (RecordIdentifierMetas, error)
SetById adds or updates a RecordIdentifierMeta by ID only.
func (RecordIdentifierMetas) SetByType ¶
func (rids RecordIdentifierMetas) SetByType(target *RecordIdentifierMeta) (RecordIdentifierMetas, error)
SetByType adds or updates a RecordIdentifierMeta by matching based on type only.
func (RecordIdentifierMetas) SetByTypeAndId ¶
func (rids RecordIdentifierMetas) SetByTypeAndId(recIdType RecordIdentifierType, id string) (RecordIdentifierMetas, error)
SetByTypeAndId adds or updates a RecordIdentifierMeta by type and ID, matching both.
func (RecordIdentifierMetas) SetWithOptions ¶
func (rids RecordIdentifierMetas) SetWithOptions(target *RecordIdentifierMeta, matchByType bool, matchById bool) (RecordIdentifierMetas, error)
SetWithOptions adds or updates a RecordIdentifierMeta in the RecordIdentifierMetas array with flexible matching options.
type RecordIdentifierType ¶
type RecordIdentifierType string
RecordIdentifierType represents the type of action performed on a database record.
const ( REC_ID_USER RecordIdentifierType = "user" REC_ID_EMAIL RecordIdentifierType = "email" REC_ID_PHONE RecordIdentifierType = "phone" )
Constants for RecordIdentifierType values.
func (RecordIdentifierType) IsEmpty ¶
func (rt RecordIdentifierType) IsEmpty() bool
IsEmpty checks if the RecordIdentifierType is empty after trimming whitespace.
func (RecordIdentifierType) IsValid ¶
func (rt RecordIdentifierType) IsValid() bool
IsValid checks if the RecordIdentifierType is one of the allowed constants.
func (RecordIdentifierType) String ¶
func (rt RecordIdentifierType) String() string
String converts the RecordIdentifierType to a regular string.
func (RecordIdentifierType) TrimSpace ¶
func (rt RecordIdentifierType) TrimSpace() RecordIdentifierType
TrimSpace returns a new RecordIdentifierType with leading and trailing whitespace removed.
type RecordIdentifierTypes ¶
type RecordIdentifierTypes []RecordIdentifierType
func RECIDENTIFIERS ¶
func RECIDENTIFIERS() RecordIdentifierTypes
func (RecordIdentifierTypes) HasMatch ¶
func (rts RecordIdentifierTypes) HasMatch(recIdType RecordIdentifierType) bool
type RecordSecurity ¶
type RecordSecurity struct {
User auser.RecordUserIdentity `json:"user,omitempty"`
Action RecordActionType `json:"action,omitempty"`
Event string `json:"event,omitempty"`
Time time.Time `json:"time,omitempty"`
History RecordSecurityHistoryTimes `json:"history,omitempty"`
Error *aerr.Error `json:"error,omitempty"`
RecIds atags.TagArrStrings `json:"recIds,omitempty"`
Meta json.RawMessage `json:"meta,omitempty"`
}
RecordSecurity is used for tracking the security-related changes and actions performed on a database record. It includes the user who performed the action, the action itself, and a history of past actions.
func NewRecordSecurity ¶
func NewRecordSecurity(user auser.RecordUserIdentity, action RecordActionType, event string) *RecordSecurity
NewRecordSecurity creates a new RecordSecurity instance with the current time.
func (*RecordSecurity) EnsureEventDefaults ¶
func (rs *RecordSecurity) EnsureEventDefaults(cols DbColumnNames)
EnsureEventDefaults sets a default event description based on the provided column names if the event is not already set.
func (*RecordSecurity) IsValid ¶
func (rs *RecordSecurity) IsValid() error
IsValid checks if the RecordSecurity instance is valid by ensuring that required fields are set and not empty.
func (RecordSecurity) MarshalJSON_Log_NoTimeNoHistory ¶
func (rs RecordSecurity) MarshalJSON_Log_NoTimeNoHistory() ([]byte, error)
func (*RecordSecurity) UpdateFrom ¶
func (rs *RecordSecurity) UpdateFrom(target *RecordSecurity) error
UpdateFrom updates the current RecordSecurity with information from another instance, adding the previous state to the history.
type RecordSecurityHistoryTime ¶
type RecordSecurityHistoryTime struct {
User auser.RecordUserIdentity `json:"user"`
Action RecordActionType `json:"action"`
Event string `json:"event"`
Time time.Time `json:"time"`
}
RecordSecurityHistoryTime represents a single historical security record.
type RecordSecurityHistoryTimes ¶
type RecordSecurityHistoryTimes []*RecordSecurityHistoryTime
RecordSecurityHistoryTimes is a slice of RecordSecurityHistoryTime.
func (*RecordSecurityHistoryTimes) AddEntry ¶
func (rsh *RecordSecurityHistoryTimes) AddEntry(user auser.RecordUserIdentity, action RecordActionType, event string, time time.Time)
AddEntry adds a new entry to the RecordSecurityHistoryTimes.
func (RecordSecurityHistoryTimes) FilterByAction ¶
func (rsh RecordSecurityHistoryTimes) FilterByAction(action RecordActionType) RecordSecurityHistoryTimes
FilterByAction returns a new RecordSecurityHistoryTimes containing only the entries that match the given action.
func (RecordSecurityHistoryTimes) FindEntriesByUser ¶
func (rsh RecordSecurityHistoryTimes) FindEntriesByUser(user auser.RecordUserIdentity) []*RecordSecurityHistoryTime
FindEntriesByUser returns all entries in the RecordSecurityHistoryTimes performed by a given user.
func (RecordSecurityHistoryTimes) LatestEntry ¶
func (rsh RecordSecurityHistoryTimes) LatestEntry() *RecordSecurityHistoryTime
LatestEntry returns the most recent entry in the RecordSecurityHistoryTimes.
type SBAdapterSql ¶
type SBAdapterSql struct {
// contains filtered or unexported fields
}
SBAdapterSql provides SQL capabilities for sandboxed adapters.
func NewSBAdapterSql ¶
func NewSBAdapterSql(adapter IAdapterDB, db *sql.DB) *SBAdapterSql
NewSBAdapterSql creates a new SBAdapterSql instance.
func (*SBAdapterSql) GetHost ¶
func (sba *SBAdapterSql) GetHost() string
GetHost returns the adapter host.
func (*SBAdapterSql) GetName ¶
func (sba *SBAdapterSql) GetName() AdapterName
GetName returns the adapter name.
func (*SBAdapterSql) GetType ¶
func (sba *SBAdapterSql) GetType() AdapterType
GetType returns the adapter type.
func (*SBAdapterSql) Query ¶
func (sba *SBAdapterSql) Query(query string) (ISBAdapterSqlRows, error)
Query executes a query and returns the result rows.
func (*SBAdapterSql) QueryArgs ¶
func (sba *SBAdapterSql) QueryArgs(query string, args ...interface{}) (result ISBAdapterSqlRows, err error)
QueryArgs executes a query with arguments and returns the result rows.
func (*SBAdapterSql) QueryModel ¶
func (sba *SBAdapterSql) QueryModel(query string, model interface{}) error
QueryModel returns an error as only QueryArgs is supported.
func (*SBAdapterSql) QueryModelArgs ¶
func (sba *SBAdapterSql) QueryModelArgs(query string, model interface{}, args ...interface{}) error
QueryModelArgs returns an error as only QueryArgs is supported.
func (*SBAdapterSql) SupportsModels ¶
func (sba *SBAdapterSql) SupportsModels() bool
SupportsModels returns false as models are not supported.
type SBAdapterSqlRows ¶
type SBAdapterSqlRows struct {
// contains filtered or unexported fields
}
SBAdapterSqlRows implements ISBAdapterSqlRows for sandbox environments.
func (*SBAdapterSqlRows) Close ¶
func (rows *SBAdapterSqlRows) Close() (err error)
Close closes the SQL rows.
func (*SBAdapterSqlRows) EndTimer ¶
func (rows *SBAdapterSqlRows) EndTimer() time.Duration
EndTimer ends the timer for the SQL rows operation and returns the duration.
func (*SBAdapterSqlRows) GetTimerDuration ¶
func (rows *SBAdapterSqlRows) GetTimerDuration() time.Duration
GetTimerDuration returns the duration between the start and end times.
func (*SBAdapterSqlRows) Next ¶
func (rows *SBAdapterSqlRows) Next() bool
Next advances to the next row in the result set.
func (*SBAdapterSqlRows) Scan ¶
func (rows *SBAdapterSqlRows) Scan(dest ...any) (err error)
Scan copies the columns in the current row into the values pointed at by dest.
func (*SBAdapterSqlRows) StartTimer ¶
func (rows *SBAdapterSqlRows) StartTimer()
StartTimer starts the timer for the SQL rows operation.
type TestStatus ¶
type TestStatus string
TestStatus represents the status of the connection test.
const ( TESTSTATUS_INITIALIZED TestStatus = "initialized" TESTSTATUS_INITIALIZED_SUCCESSFUL TestStatus = "initialized+test-successful" TESTSTATUS_FAILED TestStatus = "test-failed" )
Source Files
¶
- adapter.go
- adaptername.go
- adaptertype.go
- adb-adapterbase.go
- conn.go
- connactionmap.go
- connactiontype.go
- connid.go
- connsystemhelper.go
- db-column-name.go
- db-column-names.go
- iadapter.go
- iconn.go
- iimportrecordwrapper.go
- importrecordresult.go
- irecordaction.go
- irecordmodel.go
- manager.go
- record-action-type.go
- record-identifier-meta.go
- record-identifier-type.go
- record-security-history.go
- record-security.go
- ri.go
- sb-adapter-helper.go
- sb-adapter-sql.go
- sb-adapter-sqlmap.go
- sb-adapter-sqlrows.go
- sb-adapter.go
- teststatus.go
Directories
¶
| Path | Synopsis |
|---|---|
|
aclient-ftp
module
|
|
|
aclient-http
module
|
|
|
aclient-ldap
module
|
|
|
aclient-redis
module
|
|
|
aclient-smtp
module
|
|
|
adb-mssql
module
|
|
|
adb-mysql
module
|
|
|
adb-oracle
module
|
|
|
adb-pg
module
|