Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New APIs for safe numeric values #22

Merged
merged 1 commit into from
Jun 25, 2021
Merged

Conversation

knz
Copy link
Contributor

@knz knz commented Jun 25, 2021

Fixes #16.
cc @jbowens as this would have been useful in Pebble.

This introduces the following.

New basic types:

// SafeInt represents an integer that is not a sensitive value.
type SafeInt

// SafeUint represents an integer that is not a sensitive value.
type SafeUint

// SafeFloat represents a floating-point value that is not a sensitive value.
type SafeFloat

New methods in SafeWriter:

type SafeWriter interface {
    ...
    // SafeInt emits a safe integer.
    SafeInt(SafeInt)

    // SafeUint emits a safe unsigned integer.
    SafeUint(SafeUint)

    // SafeFloat emits a safe floating-point value.
    SafeFloat(SafeFloat)
}

This change is Reviewable

This introduces the following.

New basic types:

```go
// SafeInt represents an integer that is not a sensitive value.
type SafeInt

// SafeUint represents an integer that is not a sensitive value.
type SafeUint

// SafeFloat represents a floating-point value that is not a sensitive value.
type SafeFloat
```

New methods in `SafeWriter`:

```go
type SafeWriter interface {
    ...
    // SafeInt emits a safe integer.
    SafeInt(SafeInt)

    // SafeUint emits a safe unsigned integer.
    SafeUint(SafeUint)

    // SafeFloat emits a safe floating-point value.
    SafeFloat(SafeFloat)
}
```
@knz knz merged commit 2c44c49 into cockroachdb:master Jun 25, 2021
@knz knz deleted the 20210625-safe-nums branch June 25, 2021 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it easier to print out safe integers and floats
1 participant