package harness

import "github.com/datastax/astra-db-go/v2/integration/harness"

Index

Constants

const (
	DefaultCollectionName = "default_collection"
	DefaultTableName      = "default_table"
	DefaultUDTName        = "example_udt"
)
const (
	SelectCollections tOrCSelect = 1 << iota
	SelectTables
)
const (
	SelectBefore bOrASelect = 1 << iota
	SelectAfter
)

Variables

var Ctx = context.Background()
var EverythingTableSchema = must(table.Infer[EverythingRow]())
var EverythingTableSchemaWithVectorize = must(table.Infer[EverythingRowWithVectorize]())
var ExampleUDTSchema = must(table.InferUDT[ExampleUDT]())
var TestKeyspaces = []string{"default_keyspace", "other_keyspace"}
var TestsDirectory string

Functions

func APIEndpoint

func APIEndpoint() string

func ApplicationToken

func ApplicationToken() string

func Backend

func Backend() options.DataAPIBackend

func Bold

func Bold(msg string) string

func Faint

func Faint(msg string) string

func FprintlnChecklist

func FprintlnChecklist(w io.Writer, msg string)

func FprintlnNestedChecklist

func FprintlnNestedChecklist(w io.Writer, msg string)

func Highlight

func Highlight(msg string) string

func Init

func Init()

func PrintlnBold

func PrintlnBold(msg string)

func PrintlnChecklist

func PrintlnChecklist(msg string)

func PrintlnNestedChecklist

func PrintlnNestedChecklist(msg string)

func Run

func Run() int

func ShouldRun

func ShouldRun(s *S, testName string) bool

Types

type EverythingDoc

type EverythingDoc struct {
	ID     datatypes.UUID     `json:"_id,omitempty"`
	Vector datatypes.Vector   `json:"$vector,omitempty"`
	Nested EverythingDocInner `json:"nested"`
}

type EverythingDocInner

type EverythingDocInner struct {
	UUID     datatypes.UUID     `json:"uuid"`
	ObjectId datatypes.ObjectId `json:"objectid"`
	Date     time.Time          `json:"date"`
	Big      big.Int            `json:"big"`
}

type EverythingRow

type EverythingRow struct {
	Ascii     string             `json:"ascii" astra:"type=ascii"`
	BigInt    int64              `json:"bigint"`
	Blob      []byte             `json:"blob"`
	Boolean   bool               `json:"boolean"`
	Date      datatypes.DateOnly `json:"date"`
	Decimal   big.Float          `json:"decimal"`
	Double    float64            `json:"double"`
	Duration  datatypes.Duration `json:"duration"`
	Float     float32            `json:"float"`
	Int       int                `json:"int"`
	Inet      net.IP             `json:"inet"`
	SmallInt  int16              `json:"smallint"`
	Text      string             `json:"text" astra:"pk"`
	Time      datatypes.TimeOnly `json:"time"`
	Timestamp time.Time          `json:"timestamp"`
	TinyInt   int8               `json:"tinyint"`
	UUID      datatypes.UUID     `json:"uuid"`
	Varint    big.Int            `json:"varint"`
	Vector    datatypes.Vector   `json:"vector" astra:"dim=5"`
	UDT       any                `json:"udt" astra:"type=udt[example_udt]"`
}

type EverythingRowWithVectorize

type EverythingRowWithVectorize struct {
	Ascii     string             `json:"ascii" astra:"type=ascii"`
	BigInt    int64              `json:"bigint"`
	Blob      []byte             `json:"blob"`
	Boolean   bool               `json:"boolean"`
	Date      datatypes.DateOnly `json:"date"`
	Decimal   big.Float          `json:"decimal"`
	Double    float64            `json:"double"`
	Duration  datatypes.Duration `json:"duration"`
	Float     float32            `json:"float"`
	Int       int                `json:"int"`
	Inet      net.IP             `json:"inet"`
	SmallInt  int16              `json:"smallint"`
	Text      string             `json:"text" astra:"pk"`
	Time      datatypes.TimeOnly `json:"time"`
	Timestamp time.Time          `json:"timestamp"`
	TinyInt   int8               `json:"tinyint"`
	UUID      datatypes.UUID     `json:"uuid"`
	Varint    big.Int            `json:"varint"`
	Vector1   string             `json:"vector1" astra:"vectorize,provider=openai,model=text-embedding-3-small,dim=5"`
	Vector2   string             `json:"vector2" astra:"vectorize,provider=openai,model=text-embedding-3-small,dim=5"`
	UDT       any                `json:"udt" astra:"type=udt[example_udt]"`
}

type ExampleUDT

type ExampleUDT struct {
	Name string         `json:"name"`
	Age  big.Int        `json:"age"`
	ID   datatypes.UUID `json:"id"`
}

type S

type S struct {
	Name string
	Type suiteType
	// contains filtered or unexported fields
}
func BackgroundSuite
func BackgroundSuite() *S
func ParallelSuite
func ParallelSuite(name string) *S
func SequentialSuite
func SequentialSuite(name string) *S
func (*S) After
func (s *S) After(fn func(*T)) *S
func (*S) Before
func (s *S) Before(fn func(*T)) *S
func (*S) Drop
func (s *S) Drop(tOrC tOrCSelect, bOrA bOrASelect)
func (*S) Run
func (s *S) Run(name string, fn func(*T)) *S
func (*S) Truncate
func (s *S) Truncate(tOrC tOrCSelect, bOrA bOrASelect)

type T

type T struct {
	*TestObjects
	Name string
	Ctx  context.Context
	// contains filtered or unexported fields
}

T contains all test-spec data and utilities, similar to testing.T

func (*T) Fatalf
func (t *T) Fatalf(format string, args ...any)
func (*T) Helper
func (t *T) Helper()

Helper marks the calling function as a test helper function. When printing file and line information, that function will be skipped.

func (*T) Key
func (t *T) Key(seed int) string
func (*T) Log
func (t *T) Log(items ...any)
func (*T) Logf
func (t *T) Logf(format string, args ...any)
func (*T) NoDiff
func (t *T) NoDiff(want, got any)

type TestObjects

type TestObjects struct {
	Client      *astra.DataAPIClient
	Db          *astra.Db
	Collection  *astra.Collection
	Collection_ *astra.Collection
	DbAdmin     astra.DatabaseAdmin
	Table       *astra.Table
	Table_      *astra.Table
	Admin       *astra.AstraAdmin
}
var GlobalFixtures *TestObjects
func NewTestObjects
func NewTestObjects() *TestObjects