testutil

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AppModelsSource = `package models

import "time"

type Company struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}

type User struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	CompanyID string    ` + "`orm:\"company\"`" + `
	Email     string    ` + "`orm:\"unique\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}

type Product struct {
	ID          string     ` + "`orm:\"pk\"`" + `
	CompanyID   string     ` + "`orm:\"company\"`" + `
	WorkspaceID string     ` + "`orm:\"workspace\"`" + `
	SKU         string     ` + "`orm:\"unique\"`" + `
	Name        string
	Description string
	DeletedAt   *time.Time ` + "`orm:\"soft_delete\"`" + `
	CreatedAt   time.Time  ` + "`orm:\"created_at\"`" + `
	UpdatedAt   time.Time  ` + "`orm:\"updated_at\"`" + `
}

type AuditRecord struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	CompanyID string    ` + "`orm:\"company\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	CreatedBy string    ` + "`orm:\"created_by\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
	UpdatedBy string    ` + "`orm:\"updated_by\"`" + `
}

type Role struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	Code      string    ` + "`orm:\"unique\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}
`
View Source
const MigrationModelsSourceV2 = `package models

import "time"

type Company struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}

type User struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	CompanyID string    ` + "`orm:\"company\"`" + `
	Email     string    ` + "`orm:\"unique\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}

type Product struct {
	ID          string     ` + "`orm:\"pk\"`" + `
	CompanyID   string     ` + "`orm:\"company\"`" + `
	WorkspaceID string     ` + "`orm:\"workspace\"`" + `
	SKU         string     ` + "`orm:\"unique\"`" + `
	Name        string
	Description string
	Category    string
	DeletedAt   *time.Time ` + "`orm:\"soft_delete\"`" + `
	CreatedAt   time.Time  ` + "`orm:\"created_at\"`" + `
	UpdatedAt   time.Time  ` + "`orm:\"updated_at\"`" + `
}

type AuditRecord struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	CompanyID string    ` + "`orm:\"company\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	CreatedBy string    ` + "`orm:\"created_by\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
	UpdatedBy string    ` + "`orm:\"updated_by\"`" + `
}

type Role struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	Code      string    ` + "`orm:\"unique\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}
`
View Source
const SeedModelsSource = `package models

import "time"

type Role struct {
	ID        string    ` + "`orm:\"pk\"`" + `
	Code      string    ` + "`orm:\"unique\"`" + `
	Name      string
	CreatedAt time.Time ` + "`orm:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`orm:\"updated_at\"`" + `
}
`

Variables

This section is empty.

Functions

func AccessContext

func AccessContext(userID, companyID, workspaceID string) context.Context

func ApplySchema

func ApplySchema(t testing.TB, project *itest.Project, s *schema.Schema)

func BuildSchema

func BuildSchema(t testing.TB, project *itest.Project) *schema.Schema

func ExecSQL

func ExecSQL(t testing.TB, db *sql.DB, stmt string, args ...any)

func OpenDB

func OpenDB(t testing.TB, project *itest.Project, obs orm.ObservabilityConfig) *dorm.DB

func StringID

func StringID(prefix string, n int) string

func TracingConfig

func TracingConfig(enabled bool) orm.ObservabilityConfig

func WriteModels

func WriteModels(t testing.TB, project *itest.Project, source string)

Types

type AuditRecord

type AuditRecord struct {
	ID        string
	CompanyID string
	Name      string
	CreatedAt time.Time
	CreatedBy string
	UpdatedAt time.Time
	UpdatedBy string
}

type Company

type Company struct {
	ID        string
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Fixture

type Fixture struct {
	Project *itest.Project
	Schema  *schema.Schema
}

func NewFixture

func NewFixture(t testing.TB, source string) *Fixture

type NopSpan

type NopSpan struct{}

func (NopSpan) End

func (NopSpan) End()

func (NopSpan) RecordError

func (NopSpan) RecordError(error)

func (NopSpan) SetAttributes

func (NopSpan) SetAttributes(...orm.Attribute)

type NopTracer

type NopTracer struct{}

func (NopTracer) Start

type NopTracerProvider

type NopTracerProvider struct{}

func (NopTracerProvider) Tracer

type Product

type Product struct {
	ID          string
	CompanyID   string
	WorkspaceID string
	SKU         string
	Name        string
	Description string
	DeletedAt   *time.Time
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type Role

type Role struct {
	ID        string
	Code      string
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type User

type User struct {
	ID        string
	CompanyID string
	Email     string
	Name      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

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