Help us shape the future of Go! Take the 2026 Go Developer Survey

testpolicy

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testpolicy holds the file stashgen.Generate writes for testmember.Member from a policy (see internal/genmember): the generated Encrypt, Decrypt and Fields over *testmember.Member, with the declaration testusers.User carries as tags. The encrypt tests run it against the deterministic guest beside the tag path and the -for path, so code from a policy is executed, not only compiled. `go generate ./...` rewrites member_stash.go, and CI fails when that changes it.

Index

Constants

This section is empty.

Variables

View Source
var Fields = struct {
	Age   AgeField
	Email EmailField
	Notes NotesField
}{
	Age:   AgeField{gensupport.NewField[uint32](declaration, "age")},
	Email: EmailField{gensupport.NewField[string](declaration, "email")},
	Notes: NotesField{gensupport.NewField[string](declaration, "notes")},
}

Functions

func Decrypt

func Decrypt(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedMember) ([]testmember.Member, error)

Decrypt opens each EncryptedMember, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

Types

type AgeField

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

func (AgeField) Between

func (f AgeField) Between(ctx context.Context, c *encrypt.Cipher, lo, hi uint32) (encrypt.Range[encrypt.OreTerm], error)

func (AgeField) Encrypt

func (AgeField) Eq

func (AgeField) Gt

func (AgeField) Gte

func (AgeField) Lt

func (AgeField) Lte

type EmailField

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

func (EmailField) Encrypt

func (EmailField) Eq

func (EmailField) Matches

Matches derives the matches query for v. Its answer can hold rows that do not match: decrypt the rows it fetches and keep those Verify reports true.

type EncryptedMember

type EncryptedMember struct {
	ID    int64
	Age   EncryptedMemberAge
	Email EncryptedMemberEmail
	Notes EncryptedMemberNotes
}

func Encrypt

func Encrypt(ctx context.Context, cipher *encrypt.Cipher, testpolicy []testmember.Member) ([]EncryptedMember, error)

Encrypt seals each testmember.Member, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used. The result has one element for each input, in the same order.

func (EncryptedMember) LogValue

func (e EncryptedMember) LogValue() slog.Value

func (EncryptedMember) String

func (e EncryptedMember) String() string

type EncryptedMemberAge

type EncryptedMemberAge struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Ore        encrypt.OreTerm
}

type EncryptedMemberEmail

type EncryptedMemberEmail struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Match      encrypt.MatchTerm
}

type EncryptedMemberNotes

type EncryptedMemberNotes struct {
	Ciphertext encrypt.Ciphertext
}

type NotesField

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

func (NotesField) Encrypt

Jump to

Keyboard shortcuts

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