models

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxFilterDepth int = 10
)

Variables

View Source
var (
	RootFilterAttributes = map[string]schema.Attribute{
		"and": schema.ListNestedAttribute{
			Optional: true,
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: rootFilterSchema,
			},
			Default: listdefault.StaticValue(
				types.ListNull(
					types.ObjectType{
						AttrTypes: rootFilterAttrType,
					},
				),
			),
		},
		"or": schema.ListNestedAttribute{
			Optional: true,
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: rootFilterSchema,
			},
			Default: listdefault.StaticValue(
				types.ListNull(
					types.ObjectType{
						AttrTypes: rootFilterAttrType,
					},
				),
			),
		},
	}
	RootFilterAttrTypeMap = map[string]attr.Type{
		"and": types.ListType{
			ElemType: types.ObjectType{
				AttrTypes: rootFilterAttrType,
			},
		},
		"or": types.ListType{
			ElemType: types.ObjectType{
				AttrTypes: rootFilterAttrType,
			},
		},
	}
	RootFilterWithNullChildren = types.ObjectValueMust(
		RootFilterAttrTypeMap,
		map[string]attr.Value{
			"and": types.ListValueMust(
				types.ObjectType{
					AttrTypes: rootFilterAttrType,
				},
				[]attr.Value{},
			),
			"or": types.ListValueMust(
				types.ObjectType{
					AttrTypes: rootFilterAttrType,
				},
				[]attr.Value{},
			),
		},
	)
)

Functions

func GetRecursiveFilterAttrType added in v1.0.4

func GetRecursiveFilterAttrType(depth, maxDepth int) map[string]attr.Type

func GetRecursiveFilterSchema added in v1.0.4

func GetRecursiveFilterSchema(depth, maxDepth int) map[string]schema.Attribute

func NestedModelToSDKFilter added in v1.0.4

func NestedModelToSDKFilter(ctx context.Context, model *NestedFilterModel) filterTypes.Filter

func RootModelToSDKFilter added in v1.0.4

func RootModelToSDKFilter(ctx context.Context, model *RootFilterModel) filterTypes.FilterRoot

Types

type FilterGreaterOrLessThanInt64Model

type FilterGreaterOrLessThanInt64Model struct {
	Condition types.String `tfsdk:"condition"`
	Value     types.Int64  `tfsdk:"value"`
}

func (FilterGreaterOrLessThanInt64Model) Equals added in v1.0.4

Equals returns true if all fields of the receiver match the corresponding fields of other. The Condition string field is compared case-insensitively.

type FilterRangeInt64Model

type FilterRangeInt64Model struct {
	From types.Int64 `tfsdk:"from"`
	To   types.Int64 `tfsdk:"to"`
}

func (FilterRangeInt64Model) Equals added in v1.0.4

Equals returns true if all fields of the receiver match the corresponding fields of other.

type NestedFilterModel added in v1.0.4

type NestedFilterModel struct {
	And         []NestedFilterModel `tfsdk:"and" json:"AND,omitempty"`
	Or          []NestedFilterModel `tfsdk:"or" json:"OR,omitempty"`
	SearchField types.String        `tfsdk:"search_field" json:"SEARCH_FIELD"`
	SearchType  types.String        `tfsdk:"search_type" json:"SEARCH_TYPE"`
	SearchValue types.String        `tfsdk:"search_value" json:"SEARCH_VALUE"`
}

NestedFilterModel represents a nested filter condition.

func (NestedFilterModel) Equals added in v1.0.4

func (m NestedFilterModel) Equals(other NestedFilterModel) bool

Equals returns true if all non-nil fields of the receiver match the corresponding fields of other. String fields are compared case-insensitively. Nested And/Or slices are compared recursively.

func (*NestedFilterModel) UnmarshalJSON added in v1.0.4

func (m *NestedFilterModel) UnmarshalJSON(data []byte) error

type RootFilterModel added in v1.0.4

type RootFilterModel struct {
	And []NestedFilterModel `tfsdk:"and" json:"AND,omitempty"`
	Or  []NestedFilterModel `tfsdk:"or" json:"OR,omitempty"`
}

RootFilterModel represents the root of the membership predicate.

func SDKToModel added in v1.0.4

func SDKToModel(ctx context.Context, sdkFilter filterTypes.FilterRoot) *RootFilterModel

func (RootFilterModel) Equals added in v1.0.4

func (m RootFilterModel) Equals(other *RootFilterModel) bool

Equals returns true if all non-nil fields of the receiver match the corresponding fields of other. Nested And/Or slices are compared recursively.

Jump to

Keyboard shortcuts

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