Documentation
¶
Overview ¶
package resource provides a set of types and functions for working with resources.
Index ¶
- func AddResources[Resource Resourcer](c *Collection, scope accesstypes.PermissionScope, rSet *ResourceSet[Resource]) error
- func CloneRequest(r *http.Request) (*http.Request, error)
- func Operations(r *http.Request, pattern string, opts ...Option) iter.Seq2[*Operation, error]
- func PatchsetCompare(a, b PatchSetComparer) bool
- func ProcessEvent(processName string) string
- func UserEvent(ctx context.Context) string
- func UserProcessEvent(ctx context.Context, processName string) string
- type Collection
- func (s *Collection) AddMethodResource(scope accesstypes.PermissionScope, permission accesstypes.Permission, ...) error
- func (s *Collection) AddResource(scope accesstypes.PermissionScope, permission accesstypes.Permission, ...) error
- func (s *Collection) IsResourceImmutable(scope accesstypes.PermissionScope, res accesstypes.Resource) bool
- func (s *Collection) List() map[accesstypes.Permission][]accesstypes.Resource
- func (s *Collection) ResourceExists(r accesstypes.Resource) bool
- func (s *Collection) Resources() []accesstypes.Resource
- func (s *Collection) Scope(resource accesstypes.Resource) accesstypes.PermissionScope
- func (c *Collection) TypescriptData() TypescriptData
- type Columns
- type CommitBuffer
- type Config
- type Configurer
- type DBType
- type DataChangeEvent
- type Decoder
- func (d *Decoder[Resource, Request]) Decode(request *http.Request, userPermissions UserPermissions, ...) (*PatchSet[Resource], error)
- func (d *Decoder[Resource, Request]) DecodeOperation(oper *Operation, userPermissions UserPermissions) (*PatchSet[Resource], error)
- func (d *Decoder[Resource, Request]) DecodeOperationWithoutPermissions(oper *Operation) (*PatchSet[Resource], error)
- func (d *Decoder[Resource, Request]) DecodeWithoutPermissions(request *http.Request) (*PatchSet[Resource], error)
- func (d *Decoder[Resource, Request]) WithValidator(v ValidatorFunc) *Decoder[Resource, Request]
- type DiffElem
- type DomainFromCtx
- type DomainFromReq
- type FieldDefaultFunc
- type Filter
- type FilterKey
- type FilterKeys
- type FilterType
- type Ident
- type KeyPart
- type KeySet
- type Link
- type NullLink
- type Operation
- type OperationType
- type Option
- type PartialQueryClause
- type PatchSet
- func (p *PatchSet[Resource]) Data() map[accesstypes.Field]any
- func (p *PatchSet[Resource]) Diff(old any) (map[accesstypes.Field]DiffElem, error)
- func (p *PatchSet[Resource]) EnableUserPermissionEnforcement(rSet *ResourceSet[Resource], userPermissions UserPermissions, ...) *PatchSet[Resource]
- func (p *PatchSet[Resource]) Fields() []accesstypes.Field
- func (p *PatchSet[Resource]) Get(field accesstypes.Field) any
- func (p *PatchSet[Resource]) HasKey() bool
- func (p *PatchSet[Resource]) IsSet(field accesstypes.Field) bool
- func (p *PatchSet[Resource]) Key(field accesstypes.Field) any
- func (p *PatchSet[Resource]) Len() int
- func (p *PatchSet[Resource]) PatchType() PatchType
- func (p *PatchSet[Resource]) PrimaryKey() KeySet
- func (p *PatchSet[Resource]) RegisterDefaultFunc(field accesstypes.Field, fn FieldDefaultFunc)
- func (p *PatchSet[Resource]) Resolve() (map[string]any, error)
- func (p *PatchSet[Resource]) Resource() accesstypes.Resource
- func (p *PatchSet[Resource]) Set(field accesstypes.Field, value any) *PatchSet[Resource]
- func (p *PatchSet[Resource]) SetKey(field accesstypes.Field, value any) *PatchSet[Resource]
- func (p *PatchSet[Resource]) SetPatchType(t PatchType) *PatchSet[Resource]
- func (p *PatchSet[Resource]) SpannerApply(ctx context.Context, committer SpannerCommitter, eventSource ...string) error
- func (p *PatchSet[Resource]) SpannerBuffer(ctx context.Context, txn TxnBuffer, eventSource ...string) error
- func (p *PatchSet[Resource]) SpannerBufferInsertOrUpdate(ctx context.Context, txn TxnBuffer, eventSource ...string) error
- func (p *PatchSet[Resource]) SpannerInsertOrUpdate(ctx context.Context, s *spanner.Client, eventSource ...string) error
- type PatchSetComparer
- type PatchType
- type QueryClause
- type QueryDecoder
- type QuerySet
- func (q *QuerySet[Resource]) AddField(field accesstypes.Field) *QuerySet[Resource]
- func (q *QuerySet[Resource]) Columns() (Columns, error)
- func (q *QuerySet[Resource]) EnableUserPermissionEnforcement(rSet *ResourceSet[Resource], userPermissions UserPermissions, ...) *QuerySet[Resource]
- func (q *QuerySet[Resource]) Fields() []accesstypes.Field
- func (q *QuerySet[Resource]) Key(field accesstypes.Field) any
- func (q *QuerySet[Resource]) KeySet() KeySet
- func (q *QuerySet[Resource]) Len() int
- func (q *QuerySet[Resource]) PostgresStmt() (Statement, error)
- func (q *QuerySet[Resource]) RequiredPermission() accesstypes.Permission
- func (q *QuerySet[Resource]) Resource() accesstypes.Resource
- func (q *QuerySet[Resource]) ReturnAccessableFields(b bool) *QuerySet[Resource]
- func (q *QuerySet[Resource]) SetFilterParam(filterSet *Filter)
- func (q *QuerySet[Resource]) SetKey(field accesstypes.Field, value any)
- func (q *QuerySet[Resource]) SetWhereClause(qc QueryClause)
- func (q *QuerySet[Resource]) SpannerList(ctx context.Context, db spxapi.Querier) iter.Seq2[*Resource, error]
- func (q *QuerySet[Resource]) SpannerRead(ctx context.Context, db spxapi.Querier) (*Resource, error)
- func (q *QuerySet[Resource]) SpannerStmt() (*StatementWrapper, error)
- func (q *QuerySet[Resource]) Where() (*Statement, error)
- type RPCDecoder
- type RequestFieldMapper
- type ResourceMetadata
- type ResourceSet
- func (r *ResourceSet[Resource]) BaseResource() accesstypes.Resource
- func (r *ResourceSet[Resource]) ImmutableFields() map[accesstypes.Tag]struct{}
- func (r *ResourceSet[Resource]) PermissionRequired(fieldName accesstypes.Field, perm accesstypes.Permission) bool
- func (r *ResourceSet[Resource]) Permissions() []accesstypes.Permission
- func (r *ResourceSet[Resource]) Resource(fieldName accesstypes.Field) accesstypes.Resource
- func (r *ResourceSet[Resource]) ResourceMetadata() *ResourceMetadata[Resource]
- func (r *ResourceSet[Resource]) TagPermissions() accesstypes.TagPermissions
- type Resourcer
- type RunnerFunc
- type SpannerBuffer
- type SpannerCommitter
- type Statement
- type StatementWrapper
- type StructDecoder
- type TxnBuffer
- type TxnFuncRunner
- type TxnRunner
- type TypescriptData
- type UserFromCtx
- type UserFromReq
- type UserPermissions
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResources ¶ added in v0.0.3
func AddResources[Resource Resourcer](c *Collection, scope accesstypes.PermissionScope, rSet *ResourceSet[Resource]) error
func Operations ¶ added in v0.0.3
func PatchsetCompare ¶ added in v0.0.3
func PatchsetCompare(a, b PatchSetComparer) bool
func ProcessEvent ¶ added in v0.0.3
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func NewCollection ¶
func NewCollection() *Collection
func (*Collection) AddMethodResource ¶ added in v0.1.0
func (s *Collection) AddMethodResource(scope accesstypes.PermissionScope, permission accesstypes.Permission, res accesstypes.Resource) error
func (*Collection) AddResource ¶
func (s *Collection) AddResource(scope accesstypes.PermissionScope, permission accesstypes.Permission, res accesstypes.Resource) error
func (*Collection) IsResourceImmutable ¶
func (s *Collection) IsResourceImmutable(scope accesstypes.PermissionScope, res accesstypes.Resource) bool
func (*Collection) List ¶
func (s *Collection) List() map[accesstypes.Permission][]accesstypes.Resource
func (*Collection) ResourceExists ¶ added in v0.1.7
func (s *Collection) ResourceExists(r accesstypes.Resource) bool
func (*Collection) Resources ¶ added in v0.0.10
func (s *Collection) Resources() []accesstypes.Resource
func (*Collection) Scope ¶
func (s *Collection) Scope(resource accesstypes.Resource) accesstypes.PermissionScope
func (*Collection) TypescriptData ¶ added in v0.0.10
func (c *Collection) TypescriptData() TypescriptData
type CommitBuffer ¶ added in v0.0.21
type CommitBuffer struct {
// contains filtered or unexported fields
}
func NewCommitBuffer ¶ added in v0.0.21
func NewCommitBuffer(db TxnFuncRunner, eventSource string, autoCommitSize int) *CommitBuffer
NewCommitBuffer returns a CommitBuffer that flushes the buffer when it reaches autoCommitSize, committing the content in a single transaction. A autoCommitSize of 0 means that the buffer will never be flushed automatically. The buffer can be flushed manually by calling Commit(). Commit() must be called before discarding CommitBuffer to ensure all buffered mutations are committed.
func (*CommitBuffer) Buffer ¶ added in v0.0.21
func (cb *CommitBuffer) Buffer(ctx context.Context, ps ...SpannerBuffer) error
type Config ¶ added in v0.0.3
func (Config) SetChangeTrackingTable ¶ added in v0.0.3
func (Config) SetTrackChanges ¶ added in v0.0.3
type Configurer ¶ added in v0.0.3
type Configurer interface {
Config() Config
}
type DataChangeEvent ¶ added in v0.0.3
type Decoder ¶ added in v0.0.3
Decoder is a struct that can be used for decoding http requests and validating those requests
func NewDecoder ¶ added in v0.0.3
func NewDecoder[Resource Resourcer, Request any](rSet *ResourceSet[Resource]) (*Decoder[Resource, Request], error)
func (*Decoder[Resource, Request]) Decode ¶ added in v0.0.3
func (d *Decoder[Resource, Request]) Decode(request *http.Request, userPermissions UserPermissions, requiredPermission accesstypes.Permission) (*PatchSet[Resource], error)
func (*Decoder[Resource, Request]) DecodeOperation ¶ added in v0.0.17
func (d *Decoder[Resource, Request]) DecodeOperation(oper *Operation, userPermissions UserPermissions) (*PatchSet[Resource], error)
func (*Decoder[Resource, Request]) DecodeOperationWithoutPermissions ¶ added in v0.0.17
func (*Decoder[Resource, Request]) DecodeWithoutPermissions ¶ added in v0.0.17
func (*Decoder[Resource, Request]) WithValidator ¶ added in v0.0.3
func (d *Decoder[Resource, Request]) WithValidator(v ValidatorFunc) *Decoder[Resource, Request]
type DomainFromCtx ¶ added in v0.0.3
type DomainFromCtx func(context.Context) accesstypes.Domain
type DomainFromReq ¶ added in v0.0.3
type DomainFromReq func(*http.Request) accesstypes.Domain
type FieldDefaultFunc ¶ added in v0.1.5
type Filter ¶ added in v0.0.16
type Filter struct {
// contains filtered or unexported fields
}
func (Filter) SpannerStmt ¶ added in v0.0.16
type FilterKeys ¶ added in v0.0.14
type FilterKeys struct {
// contains filtered or unexported fields
}
func NewFilterKeys ¶ added in v0.0.14
func NewFilterKeys[Req any](res Resourcer) (*FilterKeys, error)
type FilterType ¶ added in v0.0.14
type FilterType string
const ( Index FilterType = "index" SubString FilterType = "substring" FullText FilterType = "fulltext" Ngram FilterType = "ngram" )
type Ident ¶ added in v0.0.19
type Ident[T comparable] struct { // contains filtered or unexported fields }
func NewIdent ¶ added in v0.0.19
func NewIdent[T comparable](column string, px PartialQueryClause) Ident[T]
func (Ident[T]) Equal ¶ added in v0.0.19
func (i Ident[T]) Equal(v ...T) QueryClause
func (Ident[T]) GreaterThan ¶ added in v0.0.19
func (i Ident[T]) GreaterThan(v T) QueryClause
func (Ident[T]) GreaterThanEq ¶ added in v0.0.19
func (i Ident[T]) GreaterThanEq(v T) QueryClause
func (Ident[T]) LessThan ¶ added in v0.0.19
func (i Ident[T]) LessThan(v T) QueryClause
func (Ident[T]) LessThanEq ¶ added in v0.0.19
func (i Ident[T]) LessThanEq(v T) QueryClause
func (Ident[T]) NotEqual ¶ added in v0.0.19
func (i Ident[T]) NotEqual(v ...T) QueryClause
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.
type Link ¶ added in v0.0.11
type Link struct {
ID ccc.UUID `json:"id"`
Resource string `json:"resource"`
Text string `json:"text"`
}
func (*Link) DecodeSpanner ¶ added in v0.0.11
func (Link) EncodeSpanner ¶ added in v0.0.11
func (Link) MarshalJSON ¶ added in v0.0.11
func (*Link) UnmarshalJSON ¶ added in v0.0.11
type NullLink ¶ added in v0.0.11
func (*NullLink) DecodeSpanner ¶ added in v0.0.11
func (NullLink) EncodeSpanner ¶ added in v0.0.11
func (NullLink) MarshalJSON ¶ added in v0.0.11
func (*NullLink) UnmarshalJSON ¶ added in v0.0.11
type Operation ¶ added in v0.0.3
type Operation struct {
Type OperationType
Req *http.Request
}
type OperationType ¶ added in v0.0.3
type OperationType string
const ( OperationCreate OperationType = "add" OperationUpdate OperationType = "patch" OperationDelete OperationType = "remove" )
type Option ¶ added in v0.0.12
type Option func(opt options) options
func RequireCreatePath ¶ added in v0.0.12
func RequireCreatePath() Option
type PartialQueryClause ¶ added in v0.0.19
type PartialQueryClause struct {
// contains filtered or unexported fields
}
func NewPartialQueryClause ¶ added in v0.0.19
func NewPartialQueryClause() PartialQueryClause
func (PartialQueryClause) Group ¶ added in v0.0.19
func (p PartialQueryClause) Group(qc QueryClause) QueryClause
type PatchSet ¶
type PatchSet[Resource Resourcer] struct { // contains filtered or unexported fields }
func NewPatchSet ¶
func NewPatchSet[Resource Resourcer](rMeta *ResourceMetadata[Resource]) *PatchSet[Resource]
func (*PatchSet[Resource]) Diff ¶ added in v0.0.3
Diff returns a map of fields that have changed between old and patchSet.
func (*PatchSet[Resource]) EnableUserPermissionEnforcement ¶ added in v0.0.17
func (p *PatchSet[Resource]) EnableUserPermissionEnforcement(rSet *ResourceSet[Resource], userPermissions UserPermissions, requiredPermission accesstypes.Permission) *PatchSet[Resource]
func (*PatchSet[Resource]) Fields ¶
func (p *PatchSet[Resource]) Fields() []accesstypes.Field
func (*PatchSet[Resource]) IsSet ¶ added in v0.0.3
func (p *PatchSet[Resource]) IsSet(field accesstypes.Field) bool
func (*PatchSet[Resource]) PrimaryKey ¶ added in v0.0.3
func (*PatchSet[Resource]) RegisterDefaultFunc ¶ added in v0.1.5
func (p *PatchSet[Resource]) RegisterDefaultFunc(field accesstypes.Field, fn FieldDefaultFunc)
func (*PatchSet[Resource]) Resolve ¶ added in v0.0.3
Resolve returns a map with the keys set to the database struct tags found on databaseType, and the values set to the values in patchSet.
func (*PatchSet[Resource]) Resource ¶ added in v0.0.3
func (p *PatchSet[Resource]) Resource() accesstypes.Resource
func (*PatchSet[Resource]) Set ¶
func (p *PatchSet[Resource]) Set(field accesstypes.Field, value any) *PatchSet[Resource]
func (*PatchSet[Resource]) SetKey ¶
func (p *PatchSet[Resource]) SetKey(field accesstypes.Field, value any) *PatchSet[Resource]
func (*PatchSet[Resource]) SetPatchType ¶ added in v0.0.3
func (*PatchSet[Resource]) SpannerApply ¶ added in v0.0.6
func (*PatchSet[Resource]) SpannerBuffer ¶ added in v0.0.3
func (*PatchSet[Resource]) SpannerBufferInsertOrUpdate ¶ added in v0.0.3
type PatchSetComparer ¶ added in v0.0.3
type PatchSetComparer interface {
Data() map[accesstypes.Field]any
Fields() []accesstypes.Field
PatchType() PatchType
PrimaryKey() KeySet
}
type QueryClause ¶ added in v0.0.19
type QueryClause struct {
// contains filtered or unexported fields
}
func (QueryClause) And ¶ added in v0.0.19
func (x QueryClause) And() PartialQueryClause
func (QueryClause) Or ¶ added in v0.0.19
func (x QueryClause) Or() PartialQueryClause
type QueryDecoder ¶ added in v0.0.3
type QueryDecoder[Resource Resourcer, Request any] struct { // contains filtered or unexported fields }
QueryDecoder is a struct that returns columns that a given user has access to view
func NewQueryDecoder ¶ added in v0.0.3
func NewQueryDecoder[Resource Resourcer, Request any](resSet *ResourceSet[Resource]) (*QueryDecoder[Resource, Request], error)
func (*QueryDecoder[Resource, Request]) Decode ¶ added in v0.0.3
func (d *QueryDecoder[Resource, Request]) Decode(request *http.Request, userPermissions UserPermissions) (*QuerySet[Resource], error)
func (*QueryDecoder[Resource, Request]) DecodeWithoutPermissions ¶ added in v0.0.17
func (d *QueryDecoder[Resource, Request]) DecodeWithoutPermissions(request *http.Request) (*QuerySet[Resource], error)
type QuerySet ¶
type QuerySet[Resource Resourcer] struct { // contains filtered or unexported fields }
func NewQuerySet ¶
func NewQuerySet[Resource Resourcer](rMeta *ResourceMetadata[Resource]) *QuerySet[Resource]
func (*QuerySet[Resource]) AddField ¶
func (q *QuerySet[Resource]) AddField(field accesstypes.Field) *QuerySet[Resource]
func (*QuerySet[Resource]) Columns ¶ added in v0.0.3
Columns returns the database struct tags for the fields in databaseType that the user has access to view.
func (*QuerySet[Resource]) EnableUserPermissionEnforcement ¶ added in v0.0.17
func (q *QuerySet[Resource]) EnableUserPermissionEnforcement(rSet *ResourceSet[Resource], userPermissions UserPermissions, requiredPermission accesstypes.Permission) *QuerySet[Resource]
func (*QuerySet[Resource]) Fields ¶
func (q *QuerySet[Resource]) Fields() []accesstypes.Field
func (*QuerySet[Resource]) Key ¶ added in v0.0.3
func (q *QuerySet[Resource]) Key(field accesstypes.Field) any
func (*QuerySet[Resource]) PostgresStmt ¶ added in v0.0.3
func (*QuerySet[Resource]) RequiredPermission ¶ added in v0.0.17
func (q *QuerySet[Resource]) RequiredPermission() accesstypes.Permission
func (*QuerySet[Resource]) Resource ¶ added in v0.0.3
func (q *QuerySet[Resource]) Resource() accesstypes.Resource
func (*QuerySet[Resource]) ReturnAccessableFields ¶ added in v0.0.17
func (*QuerySet[Resource]) SetFilterParam ¶ added in v0.0.14
func (*QuerySet[Resource]) SetKey ¶ added in v0.0.3
func (q *QuerySet[Resource]) SetKey(field accesstypes.Field, value any)
func (*QuerySet[Resource]) SetWhereClause ¶ added in v0.0.19
func (q *QuerySet[Resource]) SetWhereClause(qc QueryClause)
func (*QuerySet[Resource]) SpannerList ¶ added in v0.0.3
func (*QuerySet[Resource]) SpannerRead ¶ added in v0.0.3
func (*QuerySet[Resource]) SpannerStmt ¶ added in v0.0.3
func (q *QuerySet[Resource]) SpannerStmt() (*StatementWrapper, error)
type RPCDecoder ¶ added in v0.1.0
type RPCDecoder[Request any] struct { // contains filtered or unexported fields }
func NewRPCDecoder ¶ added in v0.1.0
func NewRPCDecoder[Request any](userPermissions func(*http.Request) UserPermissions, methodName accesstypes.Resource, perm accesstypes.Permission) (*RPCDecoder[Request], error)
func (*RPCDecoder[Request]) Decode ¶ added in v0.1.0
func (r *RPCDecoder[Request]) Decode(request *http.Request) (*Request, error)
func (*RPCDecoder[Request]) WithValidator ¶ added in v0.1.0
func (s *RPCDecoder[Request]) WithValidator(v ValidatorFunc) *RPCDecoder[Request]
type RequestFieldMapper ¶ added in v0.0.17
type RequestFieldMapper struct {
// contains filtered or unexported fields
}
func NewRequestFieldMapper ¶ added in v0.0.17
func NewRequestFieldMapper(v any) (*RequestFieldMapper, error)
func (*RequestFieldMapper) Fields ¶ added in v0.0.17
func (f *RequestFieldMapper) Fields() []accesstypes.Field
func (*RequestFieldMapper) Len ¶ added in v0.0.17
func (f *RequestFieldMapper) Len() int
func (*RequestFieldMapper) StructFieldName ¶ added in v0.0.17
func (f *RequestFieldMapper) StructFieldName(jsonTag string) (accesstypes.Field, bool)
type ResourceMetadata ¶ added in v0.0.3
type ResourceMetadata[Resource Resourcer] struct { // contains filtered or unexported fields }
func NewResourceMetadata ¶ added in v0.0.3
func NewResourceMetadata[Resource Resourcer]() *ResourceMetadata[Resource]
func (*ResourceMetadata[Resource]) Fields ¶ added in v0.0.17
func (r *ResourceMetadata[Resource]) Fields() []accesstypes.Field
func (*ResourceMetadata[Resource]) Len ¶ added in v0.0.17
func (r *ResourceMetadata[Resource]) Len() int
type ResourceSet ¶
type ResourceSet[Resource Resourcer] struct { // contains filtered or unexported fields }
func NewResourceSet ¶
func NewResourceSet[Resource Resourcer, Request any](permissions ...accesstypes.Permission) (*ResourceSet[Resource], error)
func (*ResourceSet[Resource]) BaseResource ¶
func (r *ResourceSet[Resource]) BaseResource() accesstypes.Resource
func (*ResourceSet[Resource]) ImmutableFields ¶
func (r *ResourceSet[Resource]) ImmutableFields() map[accesstypes.Tag]struct{}
func (*ResourceSet[Resource]) PermissionRequired ¶
func (r *ResourceSet[Resource]) PermissionRequired(fieldName accesstypes.Field, perm accesstypes.Permission) bool
func (*ResourceSet[Resource]) Permissions ¶
func (r *ResourceSet[Resource]) Permissions() []accesstypes.Permission
func (*ResourceSet[Resource]) Resource ¶
func (r *ResourceSet[Resource]) Resource(fieldName accesstypes.Field) accesstypes.Resource
func (*ResourceSet[Resource]) ResourceMetadata ¶ added in v0.0.3
func (r *ResourceSet[Resource]) ResourceMetadata() *ResourceMetadata[Resource]
func (*ResourceSet[Resource]) TagPermissions ¶
func (r *ResourceSet[Resource]) TagPermissions() accesstypes.TagPermissions
type Resourcer ¶
type Resourcer interface {
Resource() accesstypes.Resource
DefaultConfig() Config
}
type RunnerFunc ¶ added in v0.0.21
RunnerFunc is a function that converts a TxnFuncRunner into a TxnRunner
type SpannerBuffer ¶ added in v0.0.18
type SpannerBuffer interface {
SpannerBuffer(ctx context.Context, txn TxnBuffer, eventSource ...string) error
}
SpannerBuffer is an interface implemented by *PatchSet that buffers its mutations in the *spanner.ReadWriteTransaction provided by TxnBuffer
type SpannerCommitter ¶ added in v0.0.21
type SpannerCommitter interface {
ReadWriteTransaction(ctx context.Context, f func(context.Context, *spanner.ReadWriteTransaction) error) (commitTimestamp time.Time, err error)
}
SpannerCommitter is an interface implemented by *spanner.Client and is used by PatchSet to allow mocking of *spanner.Client
type StatementWrapper ¶ added in v0.1.6
type StructDecoder ¶ added in v0.0.3
type StructDecoder[Request any] struct { // contains filtered or unexported fields }
StructDecoder is a struct that can be used for decoding http requests and validating those requests
func NewStructDecoder ¶ added in v0.0.3
func NewStructDecoder[Request any]() (*StructDecoder[Request], error)
func (*StructDecoder[Request]) Decode ¶ added in v0.0.3
func (s *StructDecoder[Request]) Decode(request *http.Request) (*Request, error)
func (*StructDecoder[Request]) WithValidator ¶ added in v0.0.3
func (s *StructDecoder[Request]) WithValidator(v ValidatorFunc) *StructDecoder[Request]
type TxnBuffer ¶ added in v0.0.21
TxnBuffer is an interface implemented by *spanner.ReadWriteTransaction, and is used by PatchSet to allow mocking of *spanner.ReadWriteTransaction
type TxnFuncRunner ¶ added in v0.0.21
type TxnFuncRunner interface {
ExecuteFunc(ctx context.Context, runnerFn func(ctx context.Context, txn TxnBuffer) error) error
}
TxnFuncRunner will have its ExecuteFunc() method called inside the *spanner.ReadWriteTransaction provided by TxnBuffer
type TxnRunner ¶ added in v0.0.21
TxnRunner will have its Execute() method called inside the *spanner.ReadWriteTransaction provided by TxnBuffer
type TypescriptData ¶ added in v0.0.10
type TypescriptData struct {
Permissions []accesstypes.Permission
ResourcePermissions []accesstypes.Permission
Resources []accesstypes.Resource
RPCMethods []accesstypes.Resource
ResourceTags map[accesstypes.Resource][]accesstypes.Tag
ResourcePermissionMap permissionMap
Domains []accesstypes.PermissionScope
}
type UserFromCtx ¶ added in v0.0.3
type UserFromCtx func(context.Context) accesstypes.User
type UserFromReq ¶ added in v0.0.3
type UserFromReq func(*http.Request) accesstypes.User
type UserPermissions ¶ added in v0.0.17
type UserPermissions interface {
Check(ctx context.Context, perm accesstypes.Permission, resources ...accesstypes.Resource) (ok bool, missing []accesstypes.Resource, err error)
Domain() accesstypes.Domain
User() accesstypes.User
}
UserPermissions is an interface that provides methods to check user permissions and retrieve user information, and is used in the PatchSet and QuerySet types to enforce user permissions on resources.
type ValidatorFunc ¶ added in v0.0.3
type ValidatorFunc interface {
Struct(s interface{}) error
StructPartial(s interface{}, fields ...string) error
}
ValidatorFunc is a function that validates s It returns an error if the validation fails
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
package generation provides the ability to generate resource, handler, and typescript permissions and metadata code from a resource file.
|
package generation provides the ability to generate resource, handler, and typescript permissions and metadata code from a resource file. |
|
package mock contains the code to generate mocks for the application
|
package mock contains the code to generate mocks for the application |
|
mock_accesstypes
Package mock_accesstypes is a generated GoMock package.
|
Package mock_accesstypes is a generated GoMock package. |