Documentation ¶
Index ¶
- func SetAsMap(s Set, namespace bool) map[string]any
- func SetAsMapWithNamespace(s Set) map[string]map[string]any
- func SetFields(s Set, namespace bool) []string
- func SetValues(s Set) []any
- func ValidateSet(s Set) error
- type Field
- type IssuesSet
- type Namespace
- type RepoSet
- type Set
- type Source
- type SupportedType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAsMap ¶
SetAsMap returns a map where each field name is mapped to the value of the field.
Fields are named as returned by SetFields and values are the same as those returned by SetValues.
func SetAsMapWithNamespace ¶
SetAsMapWithNamespace returns a map where the outer map contains keys corresponding to the namespace, and each inner map contains each field name mapped to the value of the field.
func SetFields ¶
SetFields returns a slice containing the names of the fields for s.
If namespace is true the field names will be prefixed with the namespace.
func SetValues ¶
SetValues returns a slice containing the values for each field for s.
The values are either `nil` if the Field is not set, or the value that was set.
func ValidateSet ¶
ValidateSet tests whether a Set is valid.
An invalid Set will return an error with the first test that failed. A valid Set will return nil.
Types ¶
type Field ¶
type Field[T SupportedType] struct { // contains filtered or unexported fields }
func Val ¶
func Val[T SupportedType](v T) Field[T]
Val is used to create a Field instance that is already set with the value v.
This method is particularly useful when creating an new instance of a Set.
s = &FooSet{ myField: signal.Val("hello, world!") }
type IssuesSet ¶
type Namespace ¶
type Namespace string
const ( // namespaceLegacy is an internal namespace used for fields that provide // compatibility with the legacy python implementation. NamespaceLegacy Namespace = "legacy" )
type RepoSet ¶
type RepoSet struct { URL Field[string] Language Field[string] License Field[string] StarCount Field[int] CreatedAt Field[time.Time] UpdatedAt Field[time.Time] CreatedSince Field[int] `signal:"legacy"` UpdatedSince Field[int] `signal:"legacy"` ContributorCount Field[int] `signal:"legacy"` OrgCount Field[int] `signal:"legacy"` CommitFrequency Field[float64] `signal:"legacy"` RecentReleaseCount Field[int] `signal:"legacy"` }
type Source ¶
type Source interface { // EmptySet returns an empty instance of a signal Set that can be used for // determining the namespace and signals supported by the Source. EmptySet() Set // IsSupported returns true if the Source supports the supplied Repo. IsSupported(projectrepo.Repo) bool // Get gathers and returns a Set of signals for the given project repo r. // // An optional string jobID can be specified and may be used by the Source // to manage caches related to a collection run. // // An error is returned if it is unable to successfully gather the signals, // or if the context is cancelled. Get(ctx context.Context, r projectrepo.Repo, jobID string) (Set, error) }
A Source is used to get a set of signals for a given project repository.