add(system): TeamSet, OrganisationSet + Resource()
This commit is contained in:
parent
13a11ab3b4
commit
27bc4c9064
80
system/types/organisation.gen.go
Normal file
80
system/types/organisation.gen.go
Normal file
@ -0,0 +1,80 @@
|
||||
package types
|
||||
|
||||
// Hello! This file is auto-generated.
|
||||
|
||||
type (
|
||||
|
||||
// OrganisationSet slice of Organisation
|
||||
//
|
||||
// This type is auto-generated.
|
||||
OrganisationSet []*Organisation
|
||||
)
|
||||
|
||||
// Walk iterates through every slice item and calls w(Organisation) err
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set OrganisationSet) Walk(w func(*Organisation) error) (err error) {
|
||||
for i := range set {
|
||||
if err = w(set[i]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Filter iterates through every slice item, calls f(Organisation) (bool, err) and return filtered slice
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set OrganisationSet) Filter(f func(*Organisation) (bool, error)) (out OrganisationSet, err error) {
|
||||
var ok bool
|
||||
out = OrganisationSet{}
|
||||
for i := range set {
|
||||
if ok, err = f(set[i]); err != nil {
|
||||
return
|
||||
} else if ok {
|
||||
out = append(out, set[i])
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// FindByID finds items from slice by its ID property
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set OrganisationSet) FindByID(ID uint64) *Organisation {
|
||||
for i := range set {
|
||||
if set[i].ID == ID {
|
||||
return set[i]
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IDs returns a slice of uint64s from all items in the set
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set OrganisationSet) IDs() (IDs []uint64) {
|
||||
IDs = make([]uint64, len(set))
|
||||
|
||||
for i := range set {
|
||||
IDs[i] = set[i].ID
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Resources returns a slice of types.Resource from all items in the set
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set OrganisationSet) Resources() (Resources []Resource) {
|
||||
Resources = make([]Resource, len(set))
|
||||
|
||||
for i := range set {
|
||||
Resources[i] = set[i].Resource()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@ -20,3 +20,12 @@ type (
|
||||
Query string
|
||||
}
|
||||
)
|
||||
|
||||
// Resource returns a system resource ID for this type
|
||||
func (r *Organisation) Resource() Resource {
|
||||
return Resource{
|
||||
ID: r.ID,
|
||||
Name: r.Name,
|
||||
Scope: "organisation",
|
||||
}
|
||||
}
|
||||
|
||||
80
system/types/team.gen.go
Normal file
80
system/types/team.gen.go
Normal file
@ -0,0 +1,80 @@
|
||||
package types
|
||||
|
||||
// Hello! This file is auto-generated.
|
||||
|
||||
type (
|
||||
|
||||
// TeamSet slice of Team
|
||||
//
|
||||
// This type is auto-generated.
|
||||
TeamSet []*Team
|
||||
)
|
||||
|
||||
// Walk iterates through every slice item and calls w(Team) err
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set TeamSet) Walk(w func(*Team) error) (err error) {
|
||||
for i := range set {
|
||||
if err = w(set[i]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Filter iterates through every slice item, calls f(Team) (bool, err) and return filtered slice
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set TeamSet) Filter(f func(*Team) (bool, error)) (out TeamSet, err error) {
|
||||
var ok bool
|
||||
out = TeamSet{}
|
||||
for i := range set {
|
||||
if ok, err = f(set[i]); err != nil {
|
||||
return
|
||||
} else if ok {
|
||||
out = append(out, set[i])
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// FindByID finds items from slice by its ID property
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set TeamSet) FindByID(ID uint64) *Team {
|
||||
for i := range set {
|
||||
if set[i].ID == ID {
|
||||
return set[i]
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IDs returns a slice of uint64s from all items in the set
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set TeamSet) IDs() (IDs []uint64) {
|
||||
IDs = make([]uint64, len(set))
|
||||
|
||||
for i := range set {
|
||||
IDs[i] = set[i].ID
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Resources returns a slice of types.Resource from all items in the set
|
||||
//
|
||||
// This function is auto-generated.
|
||||
func (set TeamSet) Resources() (Resources []Resource) {
|
||||
Resources = make([]Resource, len(set))
|
||||
|
||||
for i := range set {
|
||||
Resources[i] = set[i].Resource()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@ -20,3 +20,12 @@ type (
|
||||
Query string
|
||||
}
|
||||
)
|
||||
|
||||
// Resource returns a system resource ID for this type
|
||||
func (r *Team) Resource() Resource {
|
||||
return Resource{
|
||||
ID: r.ID,
|
||||
Name: r.Name,
|
||||
Scope: "team",
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user