Documentation ¶
Index ¶
- type Aggregation
- type AggregationAlgorithm
- type AggregationItem
- type Direction
- type Entity
- type EntityListResult
- type GroupingItem
- type Interface
- type InterfaceRecordService
- type InterfaceResourceService
- type ListParams
- type LoadParams
- type Mapper
- type RecordListResult
- type Repository
- type SaveMode
- type SortingItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregation ¶
type Aggregation struct { Items []AggregationItem `json:"items,omitempty"` Grouping []GroupingItem `json:"grouping,omitempty"` }
type AggregationAlgorithm ¶
type AggregationAlgorithm string
const ( Count AggregationAlgorithm = "COUNT" Sum AggregationAlgorithm = "SUM" Avg AggregationAlgorithm = "AVG" Max AggregationAlgorithm = "MAX" Min AggregationAlgorithm = "MIN" )
type AggregationItem ¶
type AggregationItem struct { Name string `json:"name,omitempty"` Algorithm AggregationAlgorithm `json:"algorithm,omitempty"` Property string `json:"property,omitempty"` }
type EntityListResult ¶ added in v1.3.81
type GroupingItem ¶
type GroupingItem struct {
Property string `json:"property,omitempty"`
}
type Interface ¶
type Interface interface { Create(ctx context.Context, record unstructured.Unstructured) (unstructured.Unstructured, error) Update(ctx context.Context, record unstructured.Unstructured) (unstructured.Unstructured, error) Apply(ctx context.Context, record unstructured.Unstructured) (unstructured.Unstructured, error) Load(ctx context.Context, record unstructured.Unstructured, params LoadParams) (unstructured.Unstructured, error) Delete(ctx context.Context, record unstructured.Unstructured) error List(ctx context.Context, params ListParams) (RecordListResult, error) GetResourceByType(ctx context.Context, typeName string) (*resource_model.Resource, error) }
Interface Api interface is a facade for all api services /*
func NewInterface ¶
func NewInterface2 ¶ added in v1.3.67
func NewInterface2(resourceService InterfaceResourceService, recordService InterfaceRecordService) Interface
type InterfaceRecordService ¶ added in v1.3.67
type InterfaceRecordService interface { Create(ctx context.Context, params service.RecordCreateParams) ([]*model.Record, error) Update(ctx context.Context, params service.RecordUpdateParams) ([]*model.Record, error) Apply(ctx context.Context, params service.RecordUpdateParams) ([]*model.Record, error) Delete(ctx context.Context, params service.RecordDeleteParams) error Load(ctx context.Context, namespace string, name string, properties map[string]*structpb.Value, listParams service.RecordLoadParams) (*model.Record, error) List(ctx context.Context, params service.RecordListParams) ([]*model.Record, uint32, error) }
type InterfaceResourceService ¶ added in v1.3.67
type InterfaceResourceService interface { GetResourceByName(ctx context.Context, namespace, resource string) (*model.Resource, error) Create(ctx context.Context, resource *model.Resource, doMigration bool, forceMigration bool) (*model.Resource, error) Update(ctx context.Context, resource *model.Resource, doMigration bool, forceMigration bool) error Delete(ctx context.Context, ids []string, doMigration bool, forceMigration bool) error List(ctx context.Context) ([]*model.Resource, error) }
type ListParams ¶
type ListParams struct { Query *resource_model.BooleanExpression `json:"query,omitempty"` Type string `type:"and,omitempty"` Limit uint32 `json:"limit,omitempty"` Offset uint64 `json:"offset,omitempty"` UseHistory bool `json:"useHistory,omitempty"` ResolveReferences []string `json:"resolveReferences,omitempty"` Filters map[string]interface{} `json:"filters,omitempty"` Aggregation *Aggregation `json:"aggregation,omitempty"` Sorting []SortingItem `json:"sorting,omitempty"` }
type LoadParams ¶
type Mapper ¶ added in v1.3.81
type Mapper[T Entity] interface { ToRecord(user T) *model.Record FromRecord(record *model.Record) T ToUnstructured(user T) unstructured.Unstructured }
type RecordListResult ¶
type RecordListResult struct { Total uint32 `json:"total"` Content []unstructured.Unstructured `json:"content"` }
type Repository ¶ added in v1.3.81
type Repository[T Entity] interface { Create(ctx context.Context, entity T) (T, error) Update(ctx context.Context, entity T) (T, error) Apply(ctx context.Context, entity T) (T, error) Load(ctx context.Context, entity T, params LoadParams) (T, error) Delete(ctx context.Context, entity T) error List(ctx context.Context, params ListParams) (EntityListResult[T], error) GetResourceByType(ctx context.Context, typeName string) (*resource_model.Resource, error) }
func NewRepository ¶ added in v1.3.81
func NewRepository[T Entity](api Interface, mapper Mapper[T]) Repository[T]
type SortingItem ¶
Click to show internal directories.
Click to hide internal directories.