Codegen: Cog and go fixes (#101408)
* Update to latest cog version and update workspaces * Update generated go files * Try to avoid concurrency issues * Update workspaces * Try to remove the sync... * Remove grafana dependency from xorm go.mod file
This commit is contained in:
@@ -151,7 +151,7 @@ func NewSQLExpression() *SQLExpression {
|
||||
}
|
||||
|
||||
type QueryEditorFunctionExpression struct {
|
||||
Type string `json:"type"`
|
||||
Type QueryEditorExpressionType `json:"type"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Parameters []QueryEditorFunctionParameterExpression `json:"parameters,omitempty"`
|
||||
}
|
||||
@@ -159,101 +159,35 @@ type QueryEditorFunctionExpression struct {
|
||||
// NewQueryEditorFunctionExpression creates a new QueryEditorFunctionExpression object.
|
||||
func NewQueryEditorFunctionExpression() *QueryEditorFunctionExpression {
|
||||
return &QueryEditorFunctionExpression{
|
||||
Type: "function",
|
||||
Type: QueryEditorExpressionTypeFunction,
|
||||
}
|
||||
}
|
||||
|
||||
type QueryEditorExpressionType string
|
||||
|
||||
const (
|
||||
QueryEditorExpressionTypeProperty QueryEditorExpressionType = "property"
|
||||
QueryEditorExpressionTypeOperator QueryEditorExpressionType = "operator"
|
||||
QueryEditorExpressionTypeOr QueryEditorExpressionType = "or"
|
||||
QueryEditorExpressionTypeAnd QueryEditorExpressionType = "and"
|
||||
QueryEditorExpressionTypeGroupBy QueryEditorExpressionType = "groupBy"
|
||||
QueryEditorExpressionTypeFunction QueryEditorExpressionType = "function"
|
||||
QueryEditorExpressionTypeFunctionParameter QueryEditorExpressionType = "functionParameter"
|
||||
)
|
||||
|
||||
type QueryEditorFunctionParameterExpression struct {
|
||||
Type string `json:"type"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type QueryEditorExpressionType `json:"type"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// NewQueryEditorFunctionParameterExpression creates a new QueryEditorFunctionParameterExpression object.
|
||||
func NewQueryEditorFunctionParameterExpression() *QueryEditorFunctionParameterExpression {
|
||||
return &QueryEditorFunctionParameterExpression{
|
||||
Type: "functionParameter",
|
||||
Type: QueryEditorExpressionTypeFunctionParameter,
|
||||
}
|
||||
}
|
||||
|
||||
type QueryEditorPropertyExpression struct {
|
||||
Type string `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
Type QueryEditorExpressionType `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
}
|
||||
|
||||
// NewQueryEditorPropertyExpression creates a new QueryEditorPropertyExpression object.
|
||||
func NewQueryEditorPropertyExpression() *QueryEditorPropertyExpression {
|
||||
return &QueryEditorPropertyExpression{
|
||||
Type: "property",
|
||||
Type: QueryEditorExpressionTypeProperty,
|
||||
Property: *NewQueryEditorProperty(),
|
||||
}
|
||||
}
|
||||
|
||||
type QueryEditorGroupByExpression struct {
|
||||
Type string `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
}
|
||||
|
||||
// NewQueryEditorGroupByExpression creates a new QueryEditorGroupByExpression object.
|
||||
func NewQueryEditorGroupByExpression() *QueryEditorGroupByExpression {
|
||||
return &QueryEditorGroupByExpression{
|
||||
Type: "groupBy",
|
||||
Property: *NewQueryEditorProperty(),
|
||||
}
|
||||
}
|
||||
|
||||
type QueryEditorOperatorExpression struct {
|
||||
Type string `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
// TS type is operator: QueryEditorOperator<QueryEditorOperatorValueType>, extended in veneer
|
||||
Operator QueryEditorOperator `json:"operator"`
|
||||
}
|
||||
|
||||
// NewQueryEditorOperatorExpression creates a new QueryEditorOperatorExpression object.
|
||||
func NewQueryEditorOperatorExpression() *QueryEditorOperatorExpression {
|
||||
return &QueryEditorOperatorExpression{
|
||||
Type: "operator",
|
||||
Property: *NewQueryEditorProperty(),
|
||||
Operator: *NewQueryEditorOperator(),
|
||||
}
|
||||
}
|
||||
|
||||
// TS type is QueryEditorOperator<T extends QueryEditorOperatorValueType>, extended in veneer
|
||||
type QueryEditorOperator struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Value *StringOrBoolOrInt64OrArrayOfQueryEditorOperatorType `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// NewQueryEditorOperator creates a new QueryEditorOperator object.
|
||||
func NewQueryEditorOperator() *QueryEditorOperator {
|
||||
return &QueryEditorOperator{}
|
||||
}
|
||||
|
||||
type QueryEditorOperatorValueType = StringOrBoolOrInt64OrArrayOfQueryEditorOperatorType
|
||||
|
||||
// NewQueryEditorOperatorValueType creates a new QueryEditorOperatorValueType object.
|
||||
func NewQueryEditorOperatorValueType() *QueryEditorOperatorValueType {
|
||||
return NewStringOrBoolOrInt64OrArrayOfQueryEditorOperatorType()
|
||||
}
|
||||
|
||||
type QueryEditorOperatorType = StringOrBoolOrInt64
|
||||
|
||||
// NewQueryEditorOperatorType creates a new QueryEditorOperatorType object.
|
||||
func NewQueryEditorOperatorType() *QueryEditorOperatorType {
|
||||
return NewStringOrBoolOrInt64()
|
||||
}
|
||||
|
||||
type QueryEditorProperty struct {
|
||||
Type QueryEditorPropertyType `json:"type"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
@@ -284,6 +218,72 @@ func NewQueryEditorArrayExpression() *QueryEditorArrayExpression {
|
||||
|
||||
type QueryEditorExpression any
|
||||
|
||||
type QueryEditorGroupByExpression struct {
|
||||
Type QueryEditorExpressionType `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
}
|
||||
|
||||
// NewQueryEditorGroupByExpression creates a new QueryEditorGroupByExpression object.
|
||||
func NewQueryEditorGroupByExpression() *QueryEditorGroupByExpression {
|
||||
return &QueryEditorGroupByExpression{
|
||||
Type: QueryEditorExpressionTypeGroupBy,
|
||||
Property: *NewQueryEditorProperty(),
|
||||
}
|
||||
}
|
||||
|
||||
type QueryEditorOperatorExpression struct {
|
||||
Type QueryEditorExpressionType `json:"type"`
|
||||
Property QueryEditorProperty `json:"property"`
|
||||
// TS type is operator: QueryEditorOperator<QueryEditorOperatorValueType>, extended in veneer
|
||||
Operator QueryEditorOperator `json:"operator"`
|
||||
}
|
||||
|
||||
// NewQueryEditorOperatorExpression creates a new QueryEditorOperatorExpression object.
|
||||
func NewQueryEditorOperatorExpression() *QueryEditorOperatorExpression {
|
||||
return &QueryEditorOperatorExpression{
|
||||
Type: QueryEditorExpressionTypeOperator,
|
||||
Property: *NewQueryEditorProperty(),
|
||||
Operator: *NewQueryEditorOperator(),
|
||||
}
|
||||
}
|
||||
|
||||
// TS type is QueryEditorOperator<T extends QueryEditorOperatorValueType>, extended in veneer
|
||||
type QueryEditorOperator struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Value *StringOrBoolOrInt64OrArrayOfQueryEditorOperatorType `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// NewQueryEditorOperator creates a new QueryEditorOperator object.
|
||||
func NewQueryEditorOperator() *QueryEditorOperator {
|
||||
return &QueryEditorOperator{}
|
||||
}
|
||||
|
||||
type QueryEditorOperatorType = StringOrBoolOrInt64
|
||||
|
||||
// NewQueryEditorOperatorType creates a new QueryEditorOperatorType object.
|
||||
func NewQueryEditorOperatorType() *QueryEditorOperatorType {
|
||||
return NewStringOrBoolOrInt64()
|
||||
}
|
||||
|
||||
type QueryEditorExpressionType string
|
||||
|
||||
const (
|
||||
QueryEditorExpressionTypeProperty QueryEditorExpressionType = "property"
|
||||
QueryEditorExpressionTypeOperator QueryEditorExpressionType = "operator"
|
||||
QueryEditorExpressionTypeOr QueryEditorExpressionType = "or"
|
||||
QueryEditorExpressionTypeAnd QueryEditorExpressionType = "and"
|
||||
QueryEditorExpressionTypeGroupBy QueryEditorExpressionType = "groupBy"
|
||||
QueryEditorExpressionTypeFunction QueryEditorExpressionType = "function"
|
||||
QueryEditorExpressionTypeFunctionParameter QueryEditorExpressionType = "functionParameter"
|
||||
)
|
||||
|
||||
type QueryEditorOperatorValueType = StringOrBoolOrInt64OrArrayOfQueryEditorOperatorType
|
||||
|
||||
// NewQueryEditorOperatorValueType creates a new QueryEditorOperatorValueType object.
|
||||
func NewQueryEditorOperatorValueType() *QueryEditorOperatorValueType {
|
||||
return NewStringOrBoolOrInt64OrArrayOfQueryEditorOperatorType()
|
||||
}
|
||||
|
||||
type LogsQueryLanguage string
|
||||
|
||||
const (
|
||||
@@ -525,6 +525,60 @@ func (resource *QueryEditorPropertyExpressionOrQueryEditorFunctionExpression) Un
|
||||
return fmt.Errorf("could not unmarshal resource with `type = %v`", discriminator)
|
||||
}
|
||||
|
||||
type ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression struct {
|
||||
ArrayOfQueryEditorExpression []QueryEditorExpression `json:"ArrayOfQueryEditorExpression,omitempty"`
|
||||
ArrayOfQueryEditorArrayExpression []QueryEditorArrayExpression `json:"ArrayOfQueryEditorArrayExpression,omitempty"`
|
||||
}
|
||||
|
||||
// NewArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression creates a new ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression object.
|
||||
func NewArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression() *ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression {
|
||||
return &ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression{}
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression` as JSON.
|
||||
func (resource ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression) MarshalJSON() ([]byte, error) {
|
||||
if resource.ArrayOfQueryEditorExpression != nil {
|
||||
return json.Marshal(resource.ArrayOfQueryEditorExpression)
|
||||
}
|
||||
|
||||
if resource.ArrayOfQueryEditorArrayExpression != nil {
|
||||
return json.Marshal(resource.ArrayOfQueryEditorArrayExpression)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no value for disjunction of scalars")
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression` from JSON.
|
||||
func (resource *ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression) UnmarshalJSON(raw []byte) error {
|
||||
if raw == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errList []error
|
||||
|
||||
// ArrayOfQueryEditorExpression
|
||||
var ArrayOfQueryEditorExpression []QueryEditorExpression
|
||||
if err := json.Unmarshal(raw, &ArrayOfQueryEditorExpression); err != nil {
|
||||
errList = append(errList, err)
|
||||
resource.ArrayOfQueryEditorExpression = nil
|
||||
} else {
|
||||
resource.ArrayOfQueryEditorExpression = ArrayOfQueryEditorExpression
|
||||
return nil
|
||||
}
|
||||
|
||||
// ArrayOfQueryEditorArrayExpression
|
||||
var ArrayOfQueryEditorArrayExpression []QueryEditorArrayExpression
|
||||
if err := json.Unmarshal(raw, &ArrayOfQueryEditorArrayExpression); err != nil {
|
||||
errList = append(errList, err)
|
||||
resource.ArrayOfQueryEditorArrayExpression = nil
|
||||
} else {
|
||||
resource.ArrayOfQueryEditorArrayExpression = ArrayOfQueryEditorArrayExpression
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.Join(errList...)
|
||||
}
|
||||
|
||||
type StringOrBoolOrInt64OrArrayOfQueryEditorOperatorType struct {
|
||||
String *string `json:"String,omitempty"`
|
||||
Bool *bool `json:"Bool,omitempty"`
|
||||
@@ -677,57 +731,3 @@ func (resource *StringOrBoolOrInt64) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
return errors.Join(errList...)
|
||||
}
|
||||
|
||||
type ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression struct {
|
||||
ArrayOfQueryEditorExpression []QueryEditorExpression `json:"ArrayOfQueryEditorExpression,omitempty"`
|
||||
ArrayOfQueryEditorArrayExpression []QueryEditorArrayExpression `json:"ArrayOfQueryEditorArrayExpression,omitempty"`
|
||||
}
|
||||
|
||||
// NewArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression creates a new ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression object.
|
||||
func NewArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression() *ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression {
|
||||
return &ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression{}
|
||||
}
|
||||
|
||||
// MarshalJSON implements a custom JSON marshalling logic to encode `ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression` as JSON.
|
||||
func (resource ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression) MarshalJSON() ([]byte, error) {
|
||||
if resource.ArrayOfQueryEditorExpression != nil {
|
||||
return json.Marshal(resource.ArrayOfQueryEditorExpression)
|
||||
}
|
||||
|
||||
if resource.ArrayOfQueryEditorArrayExpression != nil {
|
||||
return json.Marshal(resource.ArrayOfQueryEditorArrayExpression)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no value for disjunction of scalars")
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode `ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression` from JSON.
|
||||
func (resource *ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression) UnmarshalJSON(raw []byte) error {
|
||||
if raw == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errList []error
|
||||
|
||||
// ArrayOfQueryEditorExpression
|
||||
var ArrayOfQueryEditorExpression []QueryEditorExpression
|
||||
if err := json.Unmarshal(raw, &ArrayOfQueryEditorExpression); err != nil {
|
||||
errList = append(errList, err)
|
||||
resource.ArrayOfQueryEditorExpression = nil
|
||||
} else {
|
||||
resource.ArrayOfQueryEditorExpression = ArrayOfQueryEditorExpression
|
||||
return nil
|
||||
}
|
||||
|
||||
// ArrayOfQueryEditorArrayExpression
|
||||
var ArrayOfQueryEditorArrayExpression []QueryEditorArrayExpression
|
||||
if err := json.Unmarshal(raw, &ArrayOfQueryEditorArrayExpression); err != nil {
|
||||
errList = append(errList, err)
|
||||
resource.ArrayOfQueryEditorArrayExpression = nil
|
||||
} else {
|
||||
resource.ArrayOfQueryEditorArrayExpression = ArrayOfQueryEditorArrayExpression
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.Join(errList...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user