validation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package validation combines native Go and SQL constraint checks for one invocation-scoped typed entity. It owns validation policy, not transactions.

Index

Constants

View Source
const ConnectorDSNCheck = "datly_connector_dsn"

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DB *sql.DB
	Tx *sql.Tx
	// Dialect is existing source authority, not inferred from identifier syntax.
	Dialect *info.Dialect
}

Connection is an internal implementation carrier. Public handler capabilities receive Validator only, never this database/transaction pair.

type Service

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

func New

func New(source Source) *Service

func (*Service) MatchReference

func (s *Service) MatchReference(ctx context.Context, child, parent any, expected xhandler.ValidationReference) (*xhandler.ValidationReference, error)

MatchReference resolves an exact native constraint and compares SQL-bound values in the active default transaction. The generated caller separately proves parent INSERT policy, captured edge authority and execution order. This method neither queries the database nor issues a receipt for that proof.

func (*Service) Validate

func (s *Service) Validate(ctx context.Context, value any, options ...any) (*xhandler.Validation, error)

type Source

type Source interface {
	ValidationConnection(context.Context, string) (Connection, error)
}

Jump to

Keyboard shortcuts

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