metadata

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package metadata defines the structured metadata.

https://cloudinary.com/documentation/metadata_api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AndValidation

func AndValidation(rules []interface{}) *compositeValidation

AndValidation is relevant for all field types. Allows to include more than one validation rule to be evaluated.

func GreaterThanValidation

func GreaterThanValidation(value interface{}, equals bool) *comparisonValidationRule

GreaterThanValidation rule for integers.

func LessThanValidation

func LessThanValidation(value interface{}, equals bool) *comparisonValidationRule

LessThanValidation rule for integers.

func StringLengthValidation

func StringLengthValidation(min, max int) *valueLengthValidationRule

StringLengthValidation rule for strings.

Types

type DataSource

type DataSource struct {
	Values []DataSourceValue `json:"values"`
}

DataSource is the data source definition.

type DataSourceValue

type DataSourceValue struct {
	ExternalID string `json:"external_id"`
	Value      string `json:"value"`
	State      string `json:"state"`
}

DataSourceValue is the value of a single data source.

type Field

type Field struct {
	Type         FieldType   `json:"type"`
	ExternalID   string      `json:"external_id"`
	Label        string      `json:"label"`
	Mandatory    bool        `json:"mandatory"`
	DefaultValue interface{} `json:"default_value,omitempty"`
	Validation   interface{} `json:"validation,omitempty"`
	DataSource   DataSource  `json:"datasource,omitempty"`
}

Field is a single metadata field.

type FieldType

type FieldType string

FieldType is the type of the metadata field.

const (
	// StringFieldType is a string metadata field type.
	StringFieldType FieldType = "string"
	// IntegerFieldType is an integer metadata field type.
	IntegerFieldType FieldType = "integer"
	// DateFieldType is a date metadata field type.
	DateFieldType FieldType = "date"
	// EnumFieldType is an enum metadata field type.
	EnumFieldType FieldType = "enum"
	// SetFieldType is a set metadata field type.
	SetFieldType FieldType = "set"
)

type Validation

type Validation interface{}

Validation is the validation of the metadata field.

type ValidationType

type ValidationType string

ValidationType is the type of the metadata field validation.

Jump to

Keyboard shortcuts

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