resource

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Overview

package resource provides a set of types and functions for working with resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func NewCollection

func NewCollection() *Collection

func (*Collection) AddResource

func (s *Collection) AddResource(scope accesstypes.PermissionScope, permission accesstypes.Permission, res accesstypes.Resource) error

func (*Collection) AddResources

func (s *Collection) AddResources(scope accesstypes.PermissionScope, rSet *ResourceSet) error

func (*Collection) GenerateTypeScript

func (s *Collection) GenerateTypeScript(dst string) error

func (*Collection) IsResourceImmutable

func (s *Collection) IsResourceImmutable(scope accesstypes.PermissionScope, res accesstypes.Resource) bool

func (*Collection) List

func (*Collection) Scope

type FieldMapper

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

func NewFieldMapper

func NewFieldMapper(v any) (*FieldMapper, error)

func (*FieldMapper) Fields

func (f *FieldMapper) Fields() []accesstypes.Field

func (*FieldMapper) Len

func (f *FieldMapper) Len() int

func (*FieldMapper) StructFieldName

func (f *FieldMapper) StructFieldName(tag string) (accesstypes.Field, bool)

type KeyPart

type KeyPart struct {
	Key   accesstypes.Field
	Value any
}

type KeySet

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

KeySet is an object that represents a single or composite primary key and its value.

func NewKeySet

func NewKeySet(key accesstypes.Field, value any) KeySet

func (KeySet) Add

func (p KeySet) Add(key accesstypes.Field, value any) KeySet

Add adds an additional column to the primary key creating a composite primary key

  • PrimaryKey is immutable.
  • Add returns a new PrimaryKey that should be used for all subsequent operations.

func (KeySet) KeyMap

func (p KeySet) KeyMap() map[accesstypes.Field]any

func (KeySet) KeySet

func (p KeySet) KeySet() spanner.KeySet

func (KeySet) Len

func (p KeySet) Len() int

func (KeySet) Parts

func (p KeySet) Parts() []KeyPart

func (KeySet) RowID

func (p KeySet) RowID() string

func (KeySet) String

func (p KeySet) String() string

type PatchSet

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

func NewPatchSet

func NewPatchSet() *PatchSet

func (*PatchSet) Data

func (p *PatchSet) Data() map[accesstypes.Field]any

func (*PatchSet) Fields

func (p *PatchSet) Fields() []accesstypes.Field

func (*PatchSet) Get

func (p *PatchSet) Get(field accesstypes.Field) any

func (*PatchSet) HasKey

func (p *PatchSet) HasKey() bool

func (*PatchSet) Key

func (p *PatchSet) Key(field accesstypes.Field) any

func (*PatchSet) KeySet

func (p *PatchSet) KeySet() KeySet

func (*PatchSet) Len

func (p *PatchSet) Len() int

func (*PatchSet) Set

func (p *PatchSet) Set(field accesstypes.Field, value any) *PatchSet

func (*PatchSet) SetKey

func (p *PatchSet) SetKey(field accesstypes.Field, value any)

type QuerySet

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

func NewQuerySet

func NewQuerySet() *QuerySet

func (*QuerySet) AddField

func (p *QuerySet) AddField(field accesstypes.Field) *QuerySet

func (*QuerySet) Fields

func (p *QuerySet) Fields() []accesstypes.Field

func (*QuerySet) Len

func (p *QuerySet) Len() int

type ResourceSet

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

func NewResourceSet

func NewResourceSet[Resource Resourcer, Request any](permissions ...accesstypes.Permission) (*ResourceSet, error)

func (*ResourceSet) BaseResource

func (r *ResourceSet) BaseResource() accesstypes.Resource

func (*ResourceSet) ImmutableFields

func (r *ResourceSet) ImmutableFields() map[accesstypes.Tag]struct{}

func (*ResourceSet) Permission

func (r *ResourceSet) Permission() accesstypes.Permission

func (*ResourceSet) PermissionRequired

func (r *ResourceSet) PermissionRequired(fieldName accesstypes.Field, perm accesstypes.Permission) bool

func (*ResourceSet) Permissions

func (r *ResourceSet) Permissions() []accesstypes.Permission

func (*ResourceSet) Resource

func (r *ResourceSet) Resource(fieldName accesstypes.Field) accesstypes.Resource

func (*ResourceSet) TagPermissions

func (r *ResourceSet) TagPermissions() accesstypes.TagPermissions

type Resourcer

type Resourcer interface {
	Resource() accesstypes.Resource
}

type TSGenerator

type TSGenerator struct {
	Permissions         []accesstypes.Permission
	Resources           []accesstypes.Resource
	ResourceTags        map[accesstypes.Resource][]accesstypes.Tag
	ResourcePermissions permissionMap
	Domains             []accesstypes.PermissionScope
}

Jump to

Keyboard shortcuts

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