From d659226236188c5989a8460d0090cbf158520052 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Fri, 24 Jan 2025 09:57:42 +0000 Subject: [PATCH] Update README.md add comments to interface --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb4aa69..5e5e1ad 100755 --- a/README.md +++ b/README.md @@ -48,19 +48,30 @@ The katydid validator supports validating any serialization format that implemen ```go type Interface interface { + // Next skips to the next field or item in an array Next() error + // IsLeaf is true if this is a value and you cannot traverse down anymore IsLeaf() bool - Up() + // Down traverses down into a field value, which could be another message or array. Next must always be called after Down. Down() + // Up traverses up out of a field value and back to the field's next sibling. Next must always be called after Up. + Up() + // Value is a collection of possible values that the field might have. Value } type Value interface { + // String returns the string value if it is a string type or an error if it is not a string. + String() (string, error) + // Double returns the float64 value if it is a double type or an error if it is not a double. Double() (float64, error) + // Int returns the int64 value if it is an integer type or an error if it is not an integer. Int() (int64, error) + // Uint returns the uint64 value if it is an unsinged integer type or an error if it is not an unsinged integer. Uint() (uint64, error) + // Bool returns the bool value if it is a boolean type or an error if it is not a boolean. Bool() (bool, error) - String() (string, error) + // Bytes returns a byte slice value if it is a bytes type or an error if it is not bytes. Bytes() ([]byte, error) } ```