Documentation ¶
Index ¶
- func Create(ctx context.Context, input CreateInput) error
- func MarshalData(input CreateInput) ([]byte, error)
- func NewLoaderContext(ctx context.Context, dbConn *pgxpool.Pool) context.Context
- func RegisterTransformer(resourceType ActivityLogEntryResourceType, transformer Transformer)
- func TransformData[T any](entry GenericActivityLogEntry, f func(*T) *T) (*T, error)
- func UnmarshalData[T any](entry GenericActivityLogEntry) (*T, error)
- type ActivityLogEntry
- type ActivityLogEntryAction
- type ActivityLogEntryConnection
- type ActivityLogEntryEdge
- type ActivityLogEntryResourceType
- type CreateInput
- type GenericActivityLogEntry
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalData ¶
func MarshalData(input CreateInput) ([]byte, error)
func NewLoaderContext ¶
func RegisterTransformer ¶
func RegisterTransformer(resourceType ActivityLogEntryResourceType, transformer Transformer)
func TransformData ¶
func TransformData[T any](entry GenericActivityLogEntry, f func(*T) *T) (*T, error)
TransformData unmarshals activity log entry data and calls the provided transformer function with the data as argument.
func UnmarshalData ¶
func UnmarshalData[T any](entry GenericActivityLogEntry) (*T, error)
UnmarshalData unmarshals activity log entry data. Its inverse is MarshalData.
Types ¶
type ActivityLogEntry ¶
func GetByIdent ¶
type ActivityLogEntryAction ¶
type ActivityLogEntryAction string
const ( ActivityLogEntryActionAdded ActivityLogEntryAction = "ADDED" ActivityLogEntryActionCreated ActivityLogEntryAction = "CREATED" ActivityLogEntryActionDeleted ActivityLogEntryAction = "DELETED" ActivityLogEntryActionRemoved ActivityLogEntryAction = "REMOVED" ActivityLogEntryActionUpdated ActivityLogEntryAction = "UPDATED" )
type ActivityLogEntryConnection ¶
type ActivityLogEntryConnection = pagination.Connection[ActivityLogEntry]
func ListForResource ¶
func ListForResource(ctx context.Context, resourceType ActivityLogEntryResourceType, resourceName string, page *pagination.Pagination) (*ActivityLogEntryConnection, error)
func ListForTeam ¶
func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination) (*ActivityLogEntryConnection, error)
type ActivityLogEntryEdge ¶
type ActivityLogEntryEdge = pagination.Edge[ActivityLogEntry]
type ActivityLogEntryResourceType ¶
type ActivityLogEntryResourceType string
type CreateInput ¶
type CreateInput struct { Action ActivityLogEntryAction Actor authz.AuthenticatedUser ResourceType ActivityLogEntryResourceType ResourceName string Data any // optional EnvironmentName *string // optional TeamSlug *slug.Slug // optional }
type GenericActivityLogEntry ¶
type GenericActivityLogEntry struct { Actor string `json:"actor"` CreatedAt time.Time `json:"createdAt"` EnvironmentName *string `json:"environmentName,omitempty"` Message string `json:"message"` ResourceType ActivityLogEntryResourceType `json:"resourceType"` ResourceName string `json:"resourceName"` TeamSlug *slug.Slug `json:"teamSlug,omitempty"` Action ActivityLogEntryAction `json:"-"` UUID uuid.UUID `json:"-"` Data []byte `json:"-"` }
func (GenericActivityLogEntry) GetUUID ¶
func (a GenericActivityLogEntry) GetUUID() uuid.UUID
func (GenericActivityLogEntry) ID ¶
func (a GenericActivityLogEntry) ID() ident.Ident
func (GenericActivityLogEntry) IsNode ¶
func (GenericActivityLogEntry) IsNode()
func (GenericActivityLogEntry) WithMessage ¶
func (a GenericActivityLogEntry) WithMessage(message string) GenericActivityLogEntry
type Transformer ¶
type Transformer = func(entry GenericActivityLogEntry) (ActivityLogEntry, error)
Click to show internal directories.
Click to hide internal directories.