Documentation ¶
Index ¶
- func DeriveDeltaRecord(dst, base, delta *skydb.Record)
- func DoQueryEager(ctx context.Context, db skydb.Database, eagersIDs map[string][]skydb.RecordID, ...) map[string]map[string]*skydb.Record
- func EagerIDs(db skydb.Database, records []skydb.Record, query skydb.Query) map[string][]skydb.RecordID
- func ExtendRecordSchema(ctx context.Context, db skydb.Database, records []*skydb.Record) (bool, error)
- func MakeAssetsComplete(db skydb.Database, conn skydb.Conn, records []skydb.Record) error
- func QueryResultInfo(db skydb.Database, query *skydb.Query, ...) (map[string]interface{}, error)
- func RecordDeleteHandler(req *RecordModifyRequest, resp *RecordModifyResponse) skyerr.Error
- func RecordSaveHandler(req *RecordModifyRequest, resp *RecordModifyResponse) skyerr.Error
- type QueryResultFilter
- type RecordFetcher
- type RecordModifyRequest
- type RecordModifyResponse
- type RecordResultFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveDeltaRecord ¶
DeriveDeltaRecord derive fields in delta which is either new or different from base, and write them in dst.
It is the caller's reponsibility to ensure that base and delta identify the same record
func DoQueryEager ¶
func ExtendRecordSchema ¶
func MakeAssetsComplete ¶
func QueryResultInfo ¶
func RecordDeleteHandler ¶
func RecordDeleteHandler(req *RecordModifyRequest, resp *RecordModifyResponse) skyerr.Error
func RecordSaveHandler ¶
func RecordSaveHandler(req *RecordModifyRequest, resp *RecordModifyResponse) skyerr.Error
RecordSaveHandler iterate the record to perform the following: 1. Query the db for original record 2. Execute before save hooks with original record and new record 3. Clean up some transport only data (sequence for example) away from record 4. Populate meta data and save the record (like updated_at/by) 5. Execute after save hooks with original record and new record
Types ¶
type QueryResultFilter ¶
type QueryResultFilter struct { Database skydb.Database Query skydb.Query EagerRecords map[string]map[string]*skydb.Record RecordResultFilter RecordResultFilter }
func (*QueryResultFilter) JSONResult ¶
func (f *QueryResultFilter) JSONResult(record *skydb.Record) *skyconv.JSONRecord
type RecordFetcher ¶
type RecordFetcher struct {
// contains filtered or unexported fields
}
func NewRecordFetcher ¶
func NewRecordFetcher(ctx context.Context, db skydb.Database, conn skydb.Conn, withMasterKey bool) RecordFetcher
NewRecordFetcher provide a convenient FetchOrCreateRecord method
func (RecordFetcher) FetchOrCreateRecord ¶
func (RecordFetcher) FetchRecord ¶
type RecordModifyRequest ¶
type RecordModifyRequest struct { Db skydb.Database Conn skydb.Conn AssetStore asset.Store HookRegistry *hook.Registry Atomic bool WithMasterKey bool Context context.Context AuthInfo *skydb.AuthInfo ModifyAt time.Time // Save only RecordsToSave []*skydb.Record // Delete Only RecordIDsToDelete []skydb.RecordID // Bypass ACL even if it is restricted in _record_creation BypassCreationAccess bool }
type RecordModifyResponse ¶
type RecordResultFilter ¶
type RecordResultFilter struct { AssetStore asset.Store FieldACL skydb.FieldACL AuthInfo *skydb.AuthInfo BypassAccessControl bool }
RecordResultFilter is for processing Record into results.
- Apply field-based acl, remove fields that are not accessible to the provided authInfo
- Inject asset
- Return JSONRecord that is a copy of passed in Record that is ready to be serialized
func NewRecordResultFilter ¶
func NewRecordResultFilter(conn skydb.Conn, assetStore asset.Store, authInfo *skydb.AuthInfo, bypassAccessControl bool) (RecordResultFilter, error)
NewRecordResultFilter return a RecordResultFilter.
func (*RecordResultFilter) JSONResult ¶
func (f *RecordResultFilter) JSONResult(record *skydb.Record) *skyconv.JSONRecord