validation

package
v0.0.0-...-d065bad Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Step1Initialized tokenRequestStatus = 1000 // ;1000, Step1 process started (PENDING)
	Step1Canceled    tokenRequestStatus = 9010 // ;9010, User manually canceled, process ended (CANCELED)
	Step1MarkAllowed tokenRequestStatus = 1001 // ;1001, Marked as approved (PENDING)
	Step1MarkDenied  tokenRequestStatus = 1002 // ;1002, Marked as denied (PENDING)
	Step1Failed      tokenRequestStatus = 8010 // ;8010, Mark failed (others disagreed), waiting for user manual handling, re-enter process 1000, (FAILED)
	Step1Denied      tokenRequestStatus = 7011 // ;7011, Already denied, process ended (REJECTED)

	Step2WaitingPayment   tokenRequestStatus = 2000 // ;2000, Step1 passed, Step2 process started, user needs to start transferring Token to specified account (PENDING)
	Step2WaitingTxConfirm tokenRequestStatus = 2001 // ;2001, User has transferred, waiting for confirmation (at this time get user's TxHash) (PENDING)
	Step2Failed           tokenRequestStatus = 8020 // ;8020, Transfer inconsistent or transaction failed on chain, need to automatically return to process 2000 (automatically handled by program)

	Step3Initialized tokenRequestStatus = 3000 // ;3000, Step2 received, Step3 process started (fill in bank TransactionID) (PENDING)
	Step3MarkAllowed tokenRequestStatus = 3001 // ;3001, Marked as approved (PENDING)
	Step3Failed      tokenRequestStatus = 8030 // ;8030, Mark failed (others disagreed), waiting for user manual handling, re-enter process 3000 (FAILED)

	Step4Success tokenRequestStatus = 4000 // ;4000
)
View Source
const (
	StringActive   stringStatus = 1 // Active
	StringInactive stringStatus = 2 // Inactive
)
View Source
const (
	BytesActive   bytesStatus = 1 // Active
	BytesInactive bytesStatus = 2 // Inactive
)
View Source
const (
	PrimitiveActive   primitiveStatus = 1.5 // Active
	PrimitiveInactive primitiveStatus = 2.5 // Inactive
)

Variables

View Source
var BytesStatuses = bytesStatusesContainer{
	BytesActive: BytesStatus{
		// contains filtered or unexported fields
	},
	BytesInactive: BytesStatus{
		// contains filtered or unexported fields
	},
}

BytesStatuses is a main entry point using the BytesStatus type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var OrderStatuses = orderStatusesContainer{
	OrderPending: OrderStatus{
		// contains filtered or unexported fields
	},
	XProcessing: OrderStatus{
		// contains filtered or unexported fields
	},
	OrderShipped: OrderStatus{
		// contains filtered or unexported fields
	},
	OrderDelivered: OrderStatus{
		// contains filtered or unexported fields
	},
	OrderCancelled: OrderStatus{
		// contains filtered or unexported fields
	},
	OrderFailed: OrderStatus{
		// contains filtered or unexported fields
	},
}

OrderStatuses is a main entry point using the OrderStatus type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var PrimitiveStatuses = primitiveStatusesContainer{
	PrimitiveActive: PrimitiveStatus{
		// contains filtered or unexported fields
	},
	PrimitiveInactive: PrimitiveStatus{
		// contains filtered or unexported fields
	},
}

PrimitiveStatuses is a main entry point using the PrimitiveStatus type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var StringStatuses = stringStatusesContainer{
	None: StringStatus{
		// contains filtered or unexported fields
	},
	StringActive: StringStatus{
		// contains filtered or unexported fields
	},
	StringInactive: StringStatus{
		// contains filtered or unexported fields
	},
}

StringStatuses is a main entry point using the StringStatus type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

View Source
var TokenRequestStatuses = tokenRequestStatusesContainer{
	Step1Initialized: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step1Canceled: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step1MarkAllowed: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step1MarkDenied: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step1Failed: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step1Denied: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step2WaitingPayment: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step2WaitingTxConfirm: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step2Failed: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step3Initialized: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step3MarkAllowed: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step3Failed: TokenRequestStatus{
		// contains filtered or unexported fields
	},
	Step4Success: TokenRequestStatus{
		// contains filtered or unexported fields
	},
}

TokenRequestStatuses is a main entry point using the TokenRequestStatus type. It it a container for all enum values and provides a convenient way to access all enum values and perform operations, with convenience methods for common use cases.

Functions

This section is empty.

Types

type BytesStatus

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

BytesStatus is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func (BytesStatus) All

func (b BytesStatus) All() iter.Seq[BytesStatus]

All implements the Enum interface. It returns an iterator over all enum values.

func (BytesStatus) FromName

func (b BytesStatus) FromName(name string) (BytesStatus, bool)

FromName implements the Enum interface. It finds an enum value by name and returns the enum instance and a boolean indicating if found.

func (BytesStatus) FromValue

func (b BytesStatus) FromValue(value int) (BytesStatus, bool)

FromValue implements the Enum interface. It finds an enum instance by its underlying value and returns the enum instance and a boolean indicating if found.

func (BytesStatus) IsValid

func (b BytesStatus) IsValid() bool

IsValid checks whether the BytesStatuses value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (BytesStatus) MarshalBinary

func (b BytesStatus) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for BytesStatus. It returns the binary representation of the enum value as a byte slice.

func (BytesStatus) MarshalJSON

func (b BytesStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for BytesStatus. It returns the JSON representation of the enum value as a byte slice.

func (BytesStatus) MarshalText

func (b BytesStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for BytesStatus. It returns the text representation of the enum value as a byte slice.

func (BytesStatus) Name

func (b BytesStatus) Name() string

Name implements the Enum interface. It returns the name of the current enum value.

func (BytesStatus) SerdeFormat

func (b BytesStatus) SerdeFormat() enums.Format

SerdeFormat implements the Enum interface. It returns the format used for serialization.

func (BytesStatus) String

func (b BytesStatus) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*BytesStatus) UnmarshalBinary

func (b *BytesStatus) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for BytesStatus. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*BytesStatus) UnmarshalJSON

func (b *BytesStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for BytesStatus. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*BytesStatus) UnmarshalText

func (b *BytesStatus) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for BytesStatus. It parses the text representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (BytesStatus) Val

func (b BytesStatus) Val() int

Val implements the Enum interface. It returns the underlying enum value.

type BytesStatusRaw

type BytesStatusRaw = bytesStatus

BytesStatusRaw is a type alias for the underlying enum type bytesStatus. It provides direct access to the raw enum values for cases where you need to work with the underlying type directly.

type OrderStatus

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

OrderStatus is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func (OrderStatus) All

func (o OrderStatus) All() iter.Seq[OrderStatus]

All implements the Enum interface. It returns an iterator over all enum values.

func (OrderStatus) CanTransitionTo

func (o OrderStatus) CanTransitionTo(target OrderStatus) bool

CanTransitionTo checks if the current state can transition to the target state. Returns true if the transition is allowed, false otherwise.

func (OrderStatus) FromName

func (o OrderStatus) FromName(name string) (OrderStatus, bool)

FromName implements the Enum interface. It finds an enum value by name and returns the enum instance and a boolean indicating if found.

func (OrderStatus) FromValue

func (o OrderStatus) FromValue(value int) (OrderStatus, bool)

FromValue implements the Enum interface. It finds an enum instance by its underlying value and returns the enum instance and a boolean indicating if found.

func (OrderStatus) IsTerminalState

func (o OrderStatus) IsTerminalState() bool

IsTerminalState returns true if this state is a terminal (final) state. Terminal states cannot transition to any other state.

func (OrderStatus) IsValid

func (o OrderStatus) IsValid() bool

IsValid checks whether the OrderStatuses value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (OrderStatus) Name

func (o OrderStatus) Name() string

Name implements the Enum interface. It returns the name of the current enum value.

func (OrderStatus) SerdeFormat

func (o OrderStatus) SerdeFormat() enums.Format

SerdeFormat implements the Enum interface. It returns the format used for serialization.

func (OrderStatus) String

func (o OrderStatus) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (OrderStatus) Val

func (o OrderStatus) Val() int

Val implements the Enum interface. It returns the underlying enum value.

func (OrderStatus) ValidTransitions

func (o OrderStatus) ValidTransitions() []OrderStatus

ValidTransitions returns all valid target states that this state can transition to. Returns an empty slice if this is a terminal state or has no defined transitions.

type OrderStatusRaw

type OrderStatusRaw = orderStatus

OrderStatusRaw is a type alias for the underlying enum type orderStatus. It provides direct access to the raw enum values for cases where you need to work with the underlying type directly.

type PrimitiveStatus

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

PrimitiveStatus is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func (PrimitiveStatus) All

All implements the Enum interface. It returns an iterator over all enum values.

func (PrimitiveStatus) FromName

func (p PrimitiveStatus) FromName(name string) (PrimitiveStatus, bool)

FromName implements the Enum interface. It finds an enum value by name and returns the enum instance and a boolean indicating if found.

func (PrimitiveStatus) FromValue

func (p PrimitiveStatus) FromValue(value float32) (PrimitiveStatus, bool)

FromValue implements the Enum interface. It finds an enum instance by its underlying value and returns the enum instance and a boolean indicating if found.

func (PrimitiveStatus) IsValid

func (p PrimitiveStatus) IsValid() bool

IsValid checks whether the PrimitiveStatuses value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (PrimitiveStatus) MarshalBinary

func (p PrimitiveStatus) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for PrimitiveStatus. It returns the binary representation of the enum value as a byte slice.

func (PrimitiveStatus) MarshalJSON

func (p PrimitiveStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for PrimitiveStatus. It returns the JSON representation of the enum value as a byte slice.

func (PrimitiveStatus) MarshalText

func (p PrimitiveStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for PrimitiveStatus. It returns the text representation of the enum value as a byte slice.

func (PrimitiveStatus) Name

func (p PrimitiveStatus) Name() string

Name implements the Enum interface. It returns the name of the current enum value.

func (PrimitiveStatus) SerdeFormat

func (p PrimitiveStatus) SerdeFormat() enums.Format

SerdeFormat implements the Enum interface. It returns the format used for serialization.

func (PrimitiveStatus) String

func (p PrimitiveStatus) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*PrimitiveStatus) UnmarshalBinary

func (p *PrimitiveStatus) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for PrimitiveStatus. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*PrimitiveStatus) UnmarshalJSON

func (p *PrimitiveStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for PrimitiveStatus. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*PrimitiveStatus) UnmarshalText

func (p *PrimitiveStatus) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for PrimitiveStatus. It parses the text representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (PrimitiveStatus) Val

func (p PrimitiveStatus) Val() float32

Val implements the Enum interface. It returns the underlying enum value.

type PrimitiveStatusRaw

type PrimitiveStatusRaw = primitiveStatus

PrimitiveStatusRaw is a type alias for the underlying enum type primitiveStatus. It provides direct access to the raw enum values for cases where you need to work with the underlying type directly.

type StringStatus

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

StringStatus is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func (StringStatus) All

func (s StringStatus) All() iter.Seq[StringStatus]

All implements the Enum interface. It returns an iterator over all enum values.

func (StringStatus) FromName

func (s StringStatus) FromName(name string) (StringStatus, bool)

FromName implements the Enum interface. It finds an enum value by name and returns the enum instance and a boolean indicating if found.

func (StringStatus) FromValue

func (s StringStatus) FromValue(value int) (StringStatus, bool)

FromValue implements the Enum interface. It finds an enum instance by its underlying value and returns the enum instance and a boolean indicating if found.

func (StringStatus) IsValid

func (s StringStatus) IsValid() bool

IsValid checks whether the StringStatuses value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (StringStatus) MarshalBinary

func (s StringStatus) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for StringStatus. It returns the binary representation of the enum value as a byte slice.

func (StringStatus) MarshalJSON

func (s StringStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for StringStatus. It returns the JSON representation of the enum value as a byte slice.

func (StringStatus) MarshalText

func (s StringStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for StringStatus. It returns the text representation of the enum value as a byte slice.

func (StringStatus) MarshalYAML

func (s StringStatus) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for StringStatus. It returns the YAML representation of the enum value.

func (StringStatus) Name

func (s StringStatus) Name() string

Name implements the Enum interface. It returns the name of the current enum value.

func (StringStatus) SerdeFormat

func (s StringStatus) SerdeFormat() enums.Format

SerdeFormat implements the Enum interface. It returns the format used for serialization.

func (StringStatus) String

func (s StringStatus) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*StringStatus) UnmarshalBinary

func (s *StringStatus) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for StringStatus. It parses the binary representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*StringStatus) UnmarshalJSON

func (s *StringStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for StringStatus. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (*StringStatus) UnmarshalText

func (s *StringStatus) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for StringStatus. It parses the text representation of the enum value from the byte slice. It returns an error if the byte slice does not contain a valid enum value.

func (*StringStatus) UnmarshalYAML

func (s *StringStatus) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for StringStatus. It parses the YAML representation of the enum value. It returns an error if the YAML does not contain a valid enum value.

func (StringStatus) Val

func (s StringStatus) Val() int

Val implements the Enum interface. It returns the underlying enum value.

type StringStatusRaw

type StringStatusRaw = stringStatus

StringStatusRaw is a type alias for the underlying enum type stringStatus. It provides direct access to the raw enum values for cases where you need to work with the underlying type directly.

type TokenRequestStatus

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

TokenRequestStatus is a type that represents a single enum value. It combines the core information about the enum constant and it's defined fields.

func (TokenRequestStatus) All

All implements the Enum interface. It returns an iterator over all enum values.

func (TokenRequestStatus) FromName

func (t TokenRequestStatus) FromName(name string) (TokenRequestStatus, bool)

FromName implements the Enum interface. It finds an enum value by name and returns the enum instance and a boolean indicating if found.

func (TokenRequestStatus) FromValue

func (t TokenRequestStatus) FromValue(value int) (TokenRequestStatus, bool)

FromValue implements the Enum interface. It finds an enum instance by its underlying value and returns the enum instance and a boolean indicating if found.

func (TokenRequestStatus) IsValid

func (t TokenRequestStatus) IsValid() bool

IsValid checks whether the TokenRequestStatuses value is valid. A valid value is one that is defined in the original enum and not marked as invalid.

func (TokenRequestStatus) MarshalJSON

func (t TokenRequestStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for TokenRequestStatus. It returns the JSON representation of the enum value as a byte slice.

func (TokenRequestStatus) Name

func (t TokenRequestStatus) Name() string

Name implements the Enum interface. It returns the name of the current enum value.

func (*TokenRequestStatus) Scan

func (t *TokenRequestStatus) Scan(value any) error

Scan implements the database/sql.Scanner interface for TokenRequestStatus. It parses the database value and stores it in the enum. It returns an error if the value cannot be parsed.

func (TokenRequestStatus) SerdeFormat

func (t TokenRequestStatus) SerdeFormat() enums.Format

SerdeFormat implements the Enum interface. It returns the format used for serialization.

func (TokenRequestStatus) String

func (t TokenRequestStatus) String() string

String implements the Stringer interface. It returns the canonical absolute name of the enum value.

func (*TokenRequestStatus) UnmarshalJSON

func (t *TokenRequestStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for TokenRequestStatus. It parses the JSON representation of the enum value from the byte slice. It returns an error if the input is not a valid JSON representation.

func (TokenRequestStatus) Val

func (t TokenRequestStatus) Val() int

Val implements the Enum interface. It returns the underlying enum value.

func (TokenRequestStatus) Value

func (t TokenRequestStatus) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface for TokenRequestStatus. It returns the database representation of the enum value.

type TokenRequestStatusName

type TokenRequestStatusName string

TokenRequestStatusName is a string type for enum name constants

const (
	TokenRequestStatusNameStep1Initialized      TokenRequestStatusName = "Step1Initialized"
	TokenRequestStatusNameStep1Canceled         TokenRequestStatusName = "Step1Canceled"
	TokenRequestStatusNameStep1MarkAllowed      TokenRequestStatusName = "Step1MarkAllowed"
	TokenRequestStatusNameStep1MarkDenied       TokenRequestStatusName = "Step1MarkDenied"
	TokenRequestStatusNameStep1Failed           TokenRequestStatusName = "Step1Failed"
	TokenRequestStatusNameStep1Denied           TokenRequestStatusName = "Step1Denied"
	TokenRequestStatusNameStep2WaitingPayment   TokenRequestStatusName = "Step2WaitingPayment"
	TokenRequestStatusNameStep2WaitingTxConfirm TokenRequestStatusName = "Step2WaitingTxConfirm"
	TokenRequestStatusNameStep2Failed           TokenRequestStatusName = "Step2Failed"
	TokenRequestStatusNameStep3Initialized      TokenRequestStatusName = "Step3Initialized"
	TokenRequestStatusNameStep3MarkAllowed      TokenRequestStatusName = "Step3MarkAllowed"
	TokenRequestStatusNameStep3Failed           TokenRequestStatusName = "Step3Failed"
	TokenRequestStatusNameStep4Success          TokenRequestStatusName = "Step4Success"
)

TokenRequestStatus name constants

type TokenRequestStatusRaw

type TokenRequestStatusRaw = tokenRequestStatus

TokenRequestStatusRaw is a type alias for the underlying enum type tokenRequestStatus. It provides direct access to the raw enum values for cases where you need to work with the underlying type directly.

Jump to

Keyboard shortcuts

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