behavior

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(service Service, logger log.Logger) middleware

NewMiddleware creates a new file Middleware.

func RegisterHandlers

func RegisterHandlers(g *echo.Group, service Service,
	cacheResponse, verifyID echo.MiddlewareFunc, logger log.Logger)

func WithFilters

func WithFilters(ctx context.Context, queryParams map[string][]string) context.Context

WithFilters returns a context that contains the API filters.

Types

type Behavior

type Behavior struct {
	entity.Behavior
}

Behavior represents the data about a behavior scan.

type Repository

type Repository interface {
	// Get returns the file behavior with the specified behavior scan ID.
	Get(ctx context.Context, id string, fields []string) (entity.Behavior, error)
	// Count returns the number of behavior scans.
	Count(ctx context.Context) (int, error)
	// Exists return true when the behavior scan ID exists in the DB.
	Exists(ctx context.Context, id string) (bool, error)
	// Query returns the list of file behavior scans with the given offset and limit.
	Query(ctx context.Context, offset, limit int) ([]entity.Behavior, error)

	CountAPIs(ctx context.Context, id string) (int, error)
	CountEvents(ctx context.Context, id string) (int, error)
	CountArtifacts(ctx context.Context, id string) (int, error)
	APIs(ctx context.Context, id string, offset, limit int) (
		interface{}, error)
	Events(ctx context.Context, id string, offset, limit int) (
		interface{}, error)
	Artifacts(ctx context.Context, id string, offset, limit int) (interface{}, error)
}

Repository encapsulates the logic to access behavior scans from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new behavior repository.

type Service

type Service interface {
	Get(ctx context.Context, id string, fields []string) (Behavior, error)
	Exists(ctx context.Context, id string) (bool, error)
	Count(ctx context.Context) (int, error)
	CountAPIs(ctx context.Context, id string) (int, error)
	CountArtifacts(ctx context.Context, id string) (int, error)
	CountEvents(ctx context.Context, id string) (int, error)
	Artifacts(ctx context.Context, id string, offset, limit int) (interface{}, error)
	APIs(ctx context.Context, id string, offset, limit int) (interface{}, error)
	Events(ctx context.Context, id string, offset, limit int) (interface{}, error)
}

Service encapsulates usecase logic for behaviors.

func NewService

func NewService(repo Repository, logger log.Logger) Service

NewService creates a new user service.

Jump to

Keyboard shortcuts

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