Documentation
¶
Overview ¶
Package data contains ORM-independent tenant filtering contracts.
Index ¶
Constants ¶
View Source
const (
// DefaultTenantField is the default database field used for tenant isolation.
DefaultTenantField = "tenant_id"
)
Variables ¶
View Source
var ( // ErrNoTenant reports that a tenant-scoped filter was requested without tenant context. ErrNoTenant = gotenancy.ErrNoTenant // ErrInvalidFieldName reports an unsafe field name in filter options. ErrInvalidFieldName = errors.New("gotenancy/data: invalid field name") )
Functions ¶
This section is empty.
Types ¶
type DataFilter ¶
DataFilter provides an ORM-independent tenant filter.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is the default DataFilter implementation.
func NewFilter ¶
func NewFilter(ctx context.Context, opts ...FilterOption) (*Filter, error)
NewFilter creates a tenant filter from context.
type FilterOption ¶
type FilterOption func(*filterOptions) error
FilterOption configures a Filter.
func WithIncludeSoftDeleted ¶
func WithIncludeSoftDeleted(include bool) FilterOption
WithIncludeSoftDeleted disables the soft-delete IS NULL condition.
func WithSoftDeleteField ¶
func WithSoftDeleteField(field string) FilterOption
WithSoftDeleteField adds an IS NULL condition for soft-deleted records.
func WithTenantField ¶
func WithTenantField(field string) FilterOption
WithTenantField overrides the tenant field name.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package enttenant adapts GoTenancy data filters to Ent SQL selectors.
|
Package enttenant adapts GoTenancy data filters to Ent SQL selectors. |
|
Package gormtenant adds tenant-aware query, mutation, preload, raw SQL, and delete guardrails to GORM.
|
Package gormtenant adds tenant-aware query, mutation, preload, raw SQL, and delete guardrails to GORM. |
|
Package sqlxtenant provides tenant-filtered helpers for simple sqlx-style SELECT, UPDATE, and DELETE statements.
|
Package sqlxtenant provides tenant-filtered helpers for simple sqlx-style SELECT, UPDATE, and DELETE statements. |
Click to show internal directories.
Click to hide internal directories.