use worker

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-08-18 23:59:15 +03:00
parent 78f0ae14d7
commit 0e18a63f10
46 changed files with 2195 additions and 1181 deletions

View File

@@ -35,6 +35,477 @@ var (
_ = sort.Sort
)
// Validate checks the field values on PackagesModulesReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *PackagesModulesReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PackagesModulesReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// PackagesModulesReqMultiError, or nil if none found.
func (m *PackagesModulesReq) ValidateAll() error {
return m.validate(true)
}
func (m *PackagesModulesReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
if len(errors) > 0 {
return PackagesModulesReqMultiError(errors)
}
return nil
}
// PackagesModulesReqMultiError is an error wrapping multiple validation errors
// returned by PackagesModulesReq.ValidateAll() if the designated constraints
// aren't met.
type PackagesModulesReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PackagesModulesReqMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PackagesModulesReqMultiError) AllErrors() []error { return m }
// PackagesModulesReqValidationError is the validation error returned by
// PackagesModulesReq.Validate if the designated constraints aren't met.
type PackagesModulesReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PackagesModulesReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PackagesModulesReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PackagesModulesReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PackagesModulesReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PackagesModulesReqValidationError) ErrorName() string {
return "PackagesModulesReqValidationError"
}
// Error satisfies the builtin error interface
func (e PackagesModulesReqValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPackagesModulesReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PackagesModulesReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PackagesModulesReqValidationError{}
// Validate checks the field values on PackagesModulesRsp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *PackagesModulesRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PackagesModulesRsp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// PackagesModulesRspMultiError, or nil if none found.
func (m *PackagesModulesRsp) ValidateAll() error {
return m.validate(true)
}
func (m *PackagesModulesRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetModules() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PackagesModulesRspValidationError{
field: fmt.Sprintf("Modules[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PackagesModulesRspValidationError{
field: fmt.Sprintf("Modules[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PackagesModulesRspValidationError{
field: fmt.Sprintf("Modules[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return PackagesModulesRspMultiError(errors)
}
return nil
}
// PackagesModulesRspMultiError is an error wrapping multiple validation errors
// returned by PackagesModulesRsp.ValidateAll() if the designated constraints
// aren't met.
type PackagesModulesRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PackagesModulesRspMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PackagesModulesRspMultiError) AllErrors() []error { return m }
// PackagesModulesRspValidationError is the validation error returned by
// PackagesModulesRsp.Validate if the designated constraints aren't met.
type PackagesModulesRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PackagesModulesRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PackagesModulesRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PackagesModulesRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PackagesModulesRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PackagesModulesRspValidationError) ErrorName() string {
return "PackagesModulesRspValidationError"
}
// Error satisfies the builtin error interface
func (e PackagesModulesRspValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPackagesModulesRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PackagesModulesRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PackagesModulesRspValidationError{}
// Validate checks the field values on PackagesLookupReq with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *PackagesLookupReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PackagesLookupReq with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// PackagesLookupReqMultiError, or nil if none found.
func (m *PackagesLookupReq) ValidateAll() error {
return m.validate(true)
}
func (m *PackagesLookupReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
if len(errors) > 0 {
return PackagesLookupReqMultiError(errors)
}
return nil
}
// PackagesLookupReqMultiError is an error wrapping multiple validation errors
// returned by PackagesLookupReq.ValidateAll() if the designated constraints
// aren't met.
type PackagesLookupReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PackagesLookupReqMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PackagesLookupReqMultiError) AllErrors() []error { return m }
// PackagesLookupReqValidationError is the validation error returned by
// PackagesLookupReq.Validate if the designated constraints aren't met.
type PackagesLookupReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PackagesLookupReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PackagesLookupReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PackagesLookupReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PackagesLookupReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PackagesLookupReqValidationError) ErrorName() string {
return "PackagesLookupReqValidationError"
}
// Error satisfies the builtin error interface
func (e PackagesLookupReqValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPackagesLookupReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PackagesLookupReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PackagesLookupReqValidationError{}
// Validate checks the field values on PackagesLookupRsp with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *PackagesLookupRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PackagesLookupRsp with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// PackagesLookupRspMultiError, or nil if none found.
func (m *PackagesLookupRsp) ValidateAll() error {
return m.validate(true)
}
func (m *PackagesLookupRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetPackage()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PackagesLookupRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PackagesLookupRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PackagesLookupRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return PackagesLookupRspMultiError(errors)
}
return nil
}
// PackagesLookupRspMultiError is an error wrapping multiple validation errors
// returned by PackagesLookupRsp.ValidateAll() if the designated constraints
// aren't met.
type PackagesLookupRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PackagesLookupRspMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m PackagesLookupRspMultiError) AllErrors() []error { return m }
// PackagesLookupRspValidationError is the validation error returned by
// PackagesLookupRsp.Validate if the designated constraints aren't met.
type PackagesLookupRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PackagesLookupRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PackagesLookupRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PackagesLookupRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PackagesLookupRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PackagesLookupRspValidationError) ErrorName() string {
return "PackagesLookupRspValidationError"
}
// Error satisfies the builtin error interface
func (e PackagesLookupRspValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sPackagesLookupRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PackagesLookupRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PackagesLookupRspValidationError{}
// Validate checks the field values on ErrorRsp with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
@@ -195,6 +666,12 @@ func (m *Package) validate(all bool) error {
errors = append(errors, err)
}
// no validation rules for Modules
// no validation rules for Issues
// no validation rules for Comments
if all {
switch v := interface{}(m.GetCreated()).(type) {
case interface{ ValidateAll() error }:
@@ -253,6 +730,35 @@ func (m *Package) validate(all bool) error {
}
}
if all {
switch v := interface{}(m.GetLastCheck()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PackageValidationError{
field: "LastCheck",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PackageValidationError{
field: "LastCheck",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetLastCheck()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PackageValidationError{
field: "LastCheck",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return PackageMultiError(errors)
}
@@ -781,7 +1287,7 @@ func (m *Comment) validate(all bool) error {
errors = append(errors, err)
}
// no validation rules for Text
// no validation rules for Comment
if all {
switch v := interface{}(m.GetCreated()).(type) {
@@ -1856,7 +2362,7 @@ func (m *CommentsCreateReq) validate(all bool) error {
errors = append(errors, err)
}
// no validation rules for Text
// no validation rules for Comment
if len(errors) > 0 {
return CommentsCreateReqMultiError(errors)
@@ -2212,15 +2718,33 @@ func (m *PackagesCreateRsp) validate(all bool) error {
var errors []error
if utf8.RuneCountInString(m.GetStatus()) < 1 {
err := PackagesCreateRspValidationError{
field: "Status",
reason: "value length must be at least 1 runes",
if all {
switch v := interface{}(m.GetPackage()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, PackagesCreateRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, PackagesCreateRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
})
}
}
if !all {
return err
} else if v, ok := interface{}(m.GetPackage()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return PackagesCreateRspValidationError{
field: "Package",
reason: "embedded message failed validation",
cause: err,
}
}
errors = append(errors, err)
}
if len(errors) > 0 {