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 RegisterFilter(activityType ActivityLogActivityType, action ActivityLogEntryAction, ...)
- func RegisterTransformer(resourceType ActivityLogEntryResourceType, transformer Transformer)
- func RunRefresher(ctx context.Context, dbtx activitylogsql.DBTX, log logrus.FieldLogger)
- func TransformData[T any](entry GenericActivityLogEntry, f func(*T) *T) (*T, error)
- func UnmarshalData[T any](entry GenericActivityLogEntry) (*T, error)
- type ActivityLogActivityType
- type ActivityLogEntry
- type ActivityLogEntryAction
- type ActivityLogEntryConnection
- func ListForResource(ctx context.Context, resourceType ActivityLogEntryResourceType, ...) (*ActivityLogEntryConnection, error)
- func ListForResourceTeamAndEnvironment(ctx context.Context, resourceType ActivityLogEntryResourceType, ...) (*ActivityLogEntryConnection, error)
- func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination, ...) (*ActivityLogEntryConnection, error)
- type ActivityLogEntryEdge
- type ActivityLogEntryResourceType
- type ActivityLogFilter
- type ActivityLogger
- 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 RegisterFilter ¶
func RegisterFilter(activityType ActivityLogActivityType, action ActivityLogEntryAction, resourceType ActivityLogEntryResourceType)
func RegisterTransformer ¶
func RegisterTransformer(resourceType ActivityLogEntryResourceType, transformer Transformer)
func RunRefresher ¶
func RunRefresher(ctx context.Context, dbtx activitylogsql.DBTX, log logrus.FieldLogger)
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 ActivityLogActivityType ¶
type ActivityLogActivityType string
func (ActivityLogActivityType) IsValid ¶
func (e ActivityLogActivityType) IsValid() bool
func (ActivityLogActivityType) MarshalGQL ¶
func (e ActivityLogActivityType) MarshalGQL(w io.Writer)
func (ActivityLogActivityType) String ¶
func (e ActivityLogActivityType) String() string
func (*ActivityLogActivityType) UnmarshalGQL ¶
func (e *ActivityLogActivityType) UnmarshalGQL(v any) error
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, filter *ActivityLogFilter) (*ActivityLogEntryConnection, error)
func ListForResourceTeamAndEnvironment ¶
func ListForResourceTeamAndEnvironment(ctx context.Context, resourceType ActivityLogEntryResourceType, teamSlug slug.Slug, resourceName, environmentName string, page *pagination.Pagination, filter *ActivityLogFilter) (*ActivityLogEntryConnection, error)
func ListForTeam ¶
func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination, filter *ActivityLogFilter) (*ActivityLogEntryConnection, error)
type ActivityLogEntryEdge ¶
type ActivityLogEntryEdge = pagination.Edge[ActivityLogEntry]
type ActivityLogEntryResourceType ¶
type ActivityLogEntryResourceType string
type ActivityLogFilter ¶
type ActivityLogFilter struct {
ActivityTypes []ActivityLogActivityType `json:"activityTypes,omitempty"`
}
type ActivityLogger ¶
type ActivityLogger interface {
IsActivityLogger()
}
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)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.