validation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package validation provides input validation utilities for DataFrame operations. This package implements a comprehensive validation framework with reusable validators for common validation scenarios like column existence, length consistency, type checking, and bounds validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateColumns

func ValidateColumns(df ColumnProvider, op string, columns ...string) error

ValidateColumns is a convenience function for column validation

func ValidateIndex

func ValidateIndex(index, maxIndex int, op string) error

ValidateIndex is a convenience function for index validation

func ValidateLength

func ValidateLength(expected, actual int, op, context string) error

ValidateLength is a convenience function for length validation

func ValidateNotEmpty

func ValidateNotEmpty(df ColumnProvider, op string) error

ValidateNotEmpty is a convenience function for empty DataFrame validation

func ValidateType

func ValidateType(value interface{}, op string, supportedTypes ...reflect.Type) error

ValidateType is a convenience function for type validation

Types

type ColumnProvider

type ColumnProvider interface {
	HasColumn(name string) bool
	Columns() []string
	Len() int
	Width() int
}

ColumnProvider interface for types that provide column information

type ColumnValidator

type ColumnValidator struct {
	// contains filtered or unexported fields
}

ColumnValidator validates column existence and properties

func NewColumnValidator

func NewColumnValidator(df ColumnProvider, op string, columns ...string) *ColumnValidator

NewColumnValidator creates a validator for column operations

func (*ColumnValidator) Validate

func (v *ColumnValidator) Validate() error

Validate checks if all columns exist in the DataFrame

type CompoundValidator

type CompoundValidator struct {
	// contains filtered or unexported fields
}

CompoundValidator combines multiple validators

func NewCompoundValidator

func NewCompoundValidator(validators ...Validator) *CompoundValidator

NewCompoundValidator creates a validator that checks multiple conditions

func (*CompoundValidator) Validate

func (v *CompoundValidator) Validate() error

Validate runs all validators and returns the first error encountered

type EmptyDataFrameValidator

type EmptyDataFrameValidator struct {
	// contains filtered or unexported fields
}

EmptyDataFrameValidator validates operations on empty DataFrames

func NewEmptyDataFrameValidator

func NewEmptyDataFrameValidator(df ColumnProvider, op string) *EmptyDataFrameValidator

NewEmptyDataFrameValidator creates a validator for empty DataFrame checks

func (*EmptyDataFrameValidator) Validate

func (v *EmptyDataFrameValidator) Validate() error

Validate checks if DataFrame is empty when operation requires data

type IndexValidator

type IndexValidator struct {
	// contains filtered or unexported fields
}

IndexValidator validates index bounds

func NewIndexValidator

func NewIndexValidator(index, maxIndex int, op string) *IndexValidator

NewIndexValidator creates a validator for index operations

func (*IndexValidator) Validate

func (v *IndexValidator) Validate() error

Validate checks if index is within bounds

type LengthValidator

type LengthValidator struct {
	// contains filtered or unexported fields
}

LengthValidator validates array length consistency

func NewLengthValidator

func NewLengthValidator(expected, actual int, op, context string) *LengthValidator

NewLengthValidator creates a validator for length consistency

func (*LengthValidator) Validate

func (v *LengthValidator) Validate() error

Validate checks if lengths match

type TypeValidator

type TypeValidator struct {
	// contains filtered or unexported fields
}

TypeValidator validates supported data types

func NewTypeValidator

func NewTypeValidator(value interface{}, op string, supportedTypes ...reflect.Type) *TypeValidator

NewTypeValidator creates a validator for type checking

func (*TypeValidator) Validate

func (v *TypeValidator) Validate() error

Validate checks if the value type is supported

type Validator

type Validator interface {
	Validate() error
}

Validator interface for input validation

Jump to

Keyboard shortcuts

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