mapping

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mapping contains utilities for testing mapping between structs and enums.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAllEnumValuesAreMapped

func CheckAllEnumValuesAreMapped[T, M comparable](t testingT, from []T, to []M, mapper func(T) M)

CheckAllEnumValuesAreMapped checks if all values from the 'from' enum are mapped to the 'to' enum. It converts the enums to slices and then checks if each value in the 'from' slice is present in the 'to' slice. It uses the 'mapper' function to convert the 'from' enum value to the 'to' enum value.

func CheckAllFieldsAreMapped

func CheckAllFieldsAreMapped(t testingT, from any, to any)

CheckAllFieldsAreMapped checks if all fields from the 'from' struct are mapped to the 'to' struct. It uses reflection to iterate over the fields in the 'from' struct and checks if each field is present in the 'to' struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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