Documentation
¶
Index ¶
- Constants
- Variables
- func (e *Entity) AddCalcProps(info *RequestInfo) map[string]any
- func (reg *Registry) AddGroup(gType string, id string) (*Group, *XRError)
- func (reg *Registry) AddGroupWithObject(gType string, id string, obj Object) (*Group, *XRError)
- func (g *Group) AddResource(rType string, id string, vID string) (*Resource, *XRError)
- func (g *Group) AddResourceWithObject(rType string, id string, vID string, obj Object, objIsVer bool) (*Resource, *XRError)
- func (r *Registry) AddToCache(e *Entity)
- func (r *Resource) AddVersion(id string) (*Version, *XRError)
- func (r *Resource) AddVersionWithObject(id string, obj Object) (*Version, *XRError)
- func (m *Model) ApplyNewModel(newM *Model, src string) *XRError
- func (m *Model) ApplyNewModelFromJSON(buf []byte) *XRError
- func BuildURL(info *RequestInfo, path string) string
- func BuildURLNoUI(info *RequestInfo, path string) string
- func (r *Resource) CheckAncestors() *XRError
- func CheckAttrs(obj map[string]any, source string) *XRError
- func (r *Registry) Commit() *XRError
- func CreateDB(name string) error
- func DBExists(name string) bool
- func (m *Meta) Delete() *XRError
- func DeleteDB(name string) error
- func (v *Version) DeleteSetNextVersion(nextVersionID string) *XRError
- func Do(tx *Tx, cmd string, args ...interface{})
- func DoCount(tx *Tx, num int, cmd string, args ...interface{})
- func DoOne(tx *Tx, cmd string, args ...interface{})
- func DoOneTwo(tx *Tx, cmd string, args ...interface{})
- func DoZeroOne(tx *Tx, cmd string, args ...interface{})
- func DoZeroTwo(tx *Tx, cmd string, args ...interface{})
- func (r *Resource) DumpOrderedVersions()
- func DumpTXs()
- func DumpTimings() string
- func (r *Resource) EnsureCircularReferences() *XRError
- func (r *Resource) EnsureCompat() *XRError
- func (r *Resource) EnsureLatest() *XRError
- func (r *Resource) EnsureMaxVersions() *XRError
- func (e *Entity) EnsureNewObject() bool
- func (r *Resource) EnsureSingleVersionRoot() *XRError
- func ExtractIncomingObject(info *RequestInfo, body []byte) (Object, *XRError)
- func (reg *Registry) FindGroup(gType string, id string, anyCase bool, accessMode int) (*Group, *XRError)
- func (r *Resource) FindMeta(anyCase bool, accessMode int) (*Meta, *XRError)
- func FindRegistry(tx *Tx, id string, accessMode int) (*Registry, *XRError)
- func FindRegistryBySID(tx *Tx, sid string, accessMode int) (*Registry, *XRError)
- func (g *Group) FindResource(rType string, id string, anyCase bool, accessMode int) (*Resource, *XRError)
- func (r *Registry) FindResourceByXID(xidStr string, path string) (*Resource, *XRError)
- func (r *Resource) FindVersion(id string, anyCase bool, accessMode int) (*Version, *XRError)
- func (r *Registry) FindXIDGroup(xidStr string, path string) (*Group, *XRError)
- func (r *Registry) FindXIDMeta(xidStr string, path string) (*Meta, *XRError)
- func (r *Registry) FindXIDVersion(xidStr string, path string) (*Version, *XRError)
- func GenerateQuery(reg *Registry, what string, paths []string, filters [][]*FilterExpr, ...) (string, []interface{}, *XRError)
- func GenerateUI(info *RequestInfo, data []byte) []byte
- func (reg *Registry) Get(name string) any
- func (e *Entity) GetAsInt(path string) int
- func (e *Entity) GetAsString(path string) string
- func (e *Entity) GetAttributes(obj Object) Attributes
- func (e *Entity) GetBaseAttributes() Attributes
- func (r *Resource) GetChildVersionIDs(parentVID string) ([]string, *XRError)
- func (v *Version) GetChildren() ([]*Version, *XRError)
- func (e *Entity) GetCollections() [][2]string
- func (r *Resource) GetDefault(accessMode int) (*Version, *XRError)
- func GetDefaultReg(tx *Tx) *Registry
- func (e *Entity) GetGroupModel() *GroupModel
- func GetGroupModelInlines(gm *GroupModel) []string
- func (r *Resource) GetHasDocument() bool
- func (r *Resource) GetNewest() (*Version, *XRError)
- func (r *Resource) GetNewestVersionID() (string, *XRError)
- func (r *Resource) GetNumberOfVersions() (int, *XRError)
- func (r *Resource) GetOrderedVersionIDs() ([]*VersionAncestor, *XRError)
- func (e *Entity) GetOrigin(path string) any
- func (e *Entity) GetPP(pp *PropPath) any
- func (r *Resource) GetProblematicVersions() ([]*VersionAncestor, *XRError)
- func (e *Entity) GetPropsOrdered() ([]*Attribute, map[string]*Attribute)
- func GetRegistryModelInlines(m *Model) []string
- func GetRegistryNames() ([]string, *XRError)
- func (e *Entity) GetRequestInfo() *RequestInfo
- func (e *Entity) GetResourceModel() *ResourceModel
- func GetResourceModelInlines(rm *ResourceModel) []string
- func (e *Entity) GetResourceSingular() string
- func (r *Resource) GetRootVersionIDs() ([]string, *XRError)
- func (r *Registry) GetTx() *Tx
- func (r *Resource) GetVersionIDs() ([]string, *XRError)
- func (r *Resource) GetVersionMode() VersionMode
- func GetVersionModelInlines(rm *ResourceModel) []string
- func GetVersionSum(version *Version) (int, *XRError)
- func (r *Resource) GetVersions() ([]*Version, *XRError)
- func (r *Resource) GetXref() (string, *Resource, *XRError)
- func GoToOurType(val any) string
- func HTTPDelete(info *RequestInfo) *XRError
- func HTTPDeleteGroups(info *RequestInfo) *XRError
- func HTTPDeleteResources(info *RequestInfo) *XRError
- func HTTPDeleteVersions(info *RequestInfo) *XRError
- func HTTPGETCapabilities(info *RequestInfo) *XRError
- func HTTPGETCapabilitiesOffered(info *RequestInfo) *XRError
- func HTTPGETContent(info *RequestInfo) *XRError
- func HTTPGETModel(info *RequestInfo) *XRError
- func HTTPGETModelSource(info *RequestInfo) *XRError
- func HTTPGet(info *RequestInfo) *XRError
- func HTTPPUTCapabilities(info *RequestInfo) *XRError
- func HTTPPUTModelSource(info *RequestInfo) *XRError
- func HTTPProxy(w http.ResponseWriter, r *http.Request)
- func HTTPPutPost(info *RequestInfo) *XRError
- func HTTPWriteError(info *RequestInfo, errAny any)
- func (r *Resource) HasCircularAncestors() ([]string, *XRError)
- func IsValidJson(buf []byte) error
- func (r *Resource) IsXref() bool
- func (v *Version) JustDelete() *XRError
- func (m *Meta) JustSet(name string, val any) *XRError
- func (r *Resource) JustSetDefault(name string, val any) *XRError
- func (r *Resource) JustSetMeta(name string, val any) *XRError
- func ListDBs() ([]string, *XRError)
- func (reg *Registry) LoadCapabilities() *Capabilities
- func LoadEpochMap(info *RequestInfo) (EpochEntryMap, *XRError)
- func LoadModel(reg *Registry) *Model
- func (reg *Registry) LoadModelFromFile(file string) *XRError
- func LoadRemoteRegistry(host string) (*Registry, *XRError)
- func (e *Entity) Lock() bool
- func (e *Entity) MatchXID(str string, xid string, attr string) *XRError
- func (r *Resource) MustFindMeta(anyCase bool, accessMode int) *Meta
- func NewRegistry(tx *Tx, id string, regOpts ...RegOpt) (*Registry, *XRError)
- func NewTx() (*Tx, *XRError)
- func OpenDB(name string) *XRError
- func ParseRequest(tx *Tx, w http.ResponseWriter, r *http.Request) (*RequestInfo, *XRError)
- func Path2Abstract(path string) string
- func PrepUpdateEntity(e *Entity) *XRError
- func ProcessSetDefaultVersionIDFlag(info *RequestInfo, resource *Resource, version *Version) *XRError
- func (e *Entity) Query(query string, args ...any) [][]any
- func RawEntitiesFromQuery(tx *Tx, regID string, accessMode int, query string, args ...any) ([]*Entity, *XRError)
- func RawEntityFromPath(tx *Tx, regID string, path string, anyCase bool, accessMode int) (*Entity, *XRError)
- func (e *Entity) Refresh(accessMode int) *XRError
- func RegHTMLify(buf []byte, proxyHost, targetHost string) ([]byte, int)
- func RegisterFormat(name string, format FormatChecker)
- func (e *Entity) RemoveCollections(obj Object)
- func RemoveResourceAttributes(rm *ResourceModel, obj map[string]any)
- func RemoveVersionAttributes(rm *ResourceModel, obj map[string]any)
- func ReplaceVariables(str string) string
- func (r *Registry) Rollback() *XRError
- func (e *Entity) Save() *XRError
- func (r *Registry) SaveAllAndCommit() *XRError
- func (r *Registry) SaveCommitRefresh() *XRError
- func (reg *Registry) SaveModel() *XRError
- func (m *Model) SerializeForUser() ([]byte, *XRError)
- func (e *Entity) SerializeProps(info *RequestInfo, ...) *XRError
- func SerializeQuery(info *RequestInfo, resPaths map[string][]string, what string, ...) *XRError
- func SerializeResourceContents(jw *JsonWriter, e *Entity, info *RequestInfo, extra *string) *XRError
- func (e *Entity) SetDBProperty(pp *PropPath, val any) *XRError
- func (r *Resource) SetDefault(newDefault *Version) *XRError
- func (r *Resource) SetDefaultID(vID string) *XRError
- func (e *Entity) SetFromDBName(name string, val *string, propType string) *XRError
- func (e *Entity) SetNewObject(newObj map[string]any)
- func (e *Entity) SetPP(pp *PropPath, val any) *XRError
- func (m *Meta) SetSave(name string, val any) *XRError
- func (r *Resource) SetSaveDefault(name string, val any) *XRError
- func (r *Resource) SetSaveMeta(name string, val any) *XRError
- func (r *Resource) SetSaveResource(name string, val any) *XRError
- func (e *Entity) ShowStack()
- func SplitProp(reg *Registry, path string) (string, string)
- func SubQuery(query string, args []interface{}) string
- func (e *Entity) ToString() string
- func (e *Entity) Touch() bool
- func (reg *Registry) Update(obj Object, addType AddType) *XRError
- func (reg *Registry) UpsertGroup(gType string, id string) (*Group, bool, *XRError)
- func (reg *Registry) UpsertGroupWithObject(gType string, id string, obj Object, addType AddType) (*Group, bool, *XRError)
- func (r *Resource) UpsertMeta(mu *MetaUpsert) (*Meta, bool, *XRError)
- func (g *Group) UpsertResource(ru *ResourceUpsert) (*Resource, bool, *XRError)
- func (r *Resource) UpsertVersion(id string) (*Version, bool, *XRError)
- func (r *Resource) UpsertVersionWithObject(vu *VersionUpsert) (*Version, bool, *XRError)
- func (m *Model) UserMarshal(prefix string, indent string) ([]byte, error)
- func (e *Entity) Validate() *XRError
- func (e *Entity) ValidateAndSave() *XRError
- func (e *Entity) ValidateArray(arrayAttr *Attribute, val any, path *PropPath) *XRError
- func (e *Entity) ValidateAttribute(val any, attr *Attribute, path *PropPath) (*XRError, bool, any)
- func (e *Entity) ValidateMap(val any, item *Item, path *PropPath) *XRError
- func (e *Entity) ValidateObject(val any, namecharset string, origAttrs Attributes, path *PropPath) *XRError
- func (r *Resource) ValidateResource(onlyMetaChanged bool) *XRError
- func (e *Entity) ValidateScalar(val any, attr *Attribute, path *PropPath) (*XRError, bool, any)
- func (m *Model) VerifyAndSave() *XRError
- func (rm *ResourceModel) VerifyData() *XRError
- func (e *Entity) WasTouched() bool
- func WildcardIt(str string) (string, bool)
- func (r *Resource) WillDelete(vID string) *XRError
- func (r *Registry) XID2Entity(xidStr string, path string) (*Entity, *XRError)
- type AddType
- type BufferedWriter
- func (bw *BufferedWriter) AddHeader(name, value string)
- func (bw *BufferedWriter) Done()
- func (bw *BufferedWriter) GetHeader(name string) string
- func (bw *BufferedWriter) GetHeaderValues(name string) []string
- func (bw *BufferedWriter) SetHeader(name, value string)
- func (bw *BufferedWriter) Write(b []byte) (int, error)
- type CreatedatVersionMode
- func (vm *CreatedatVersionMode) CheckAncestors(r *Resource) *XRError
- func (vm *CreatedatVersionMode) GetOrderedVersionIDs(r *Resource) ([]*VersionAncestor, *XRError)
- func (vm *CreatedatVersionMode) Name() string
- func (vm *CreatedatVersionMode) NewestVersionID(r *Resource) (string, *XRError)
- func (vm *CreatedatVersionMode) WillDelete(r *Resource, vID string) *XRError
- type DefaultWriter
- func (dw *DefaultWriter) AddHeader(name string, value string)
- func (dw *DefaultWriter) Done()
- func (dw *DefaultWriter) GetHeader(name string) string
- func (dw *DefaultWriter) GetHeaderValues(name string) []string
- func (dw *DefaultWriter) SetHeader(name, value string)
- func (dw *DefaultWriter) Write(b []byte) (int, error)
- type DiscardWriter
- func (dw *DiscardWriter) AddHeader(name, value string)
- func (dw *DiscardWriter) Done()
- func (dw *DiscardWriter) GetHeader(name string) string
- func (dw *DiscardWriter) GetHeaderValues(name string) []string
- func (dw *DiscardWriter) SetHeader(name, value string)
- func (dw *DiscardWriter) Write(b []byte) (int, error)
- type EntityExtensions
- type EntitySetter
- type EpochEntry
- type EpochEntryMap
- type FilterExpr
- type FilterPProf
- type FormatChecker
- type FormatJson
- type FormatNumbers
- type FormatProtobuf
- type HTTPWriter
- type Inline
- type JsonWriter
- func (jw *JsonWriter) Indent()
- func (jw *JsonWriter) LoadCollections(eType int)
- func (jw *JsonWriter) NextEntity() (*Entity, *XRError)
- func (jw *JsonWriter) OptPrintf(format string, args ...any)
- func (jw *JsonWriter) Outdent()
- func (jw *JsonWriter) Pop() *Entity
- func (jw *JsonWriter) Print(str string)
- func (jw *JsonWriter) Printf(format string, args ...any)
- func (jw *JsonWriter) Push(e *Entity)
- func (jw *JsonWriter) WriteCollection() (int, *XRError)
- func (jw *JsonWriter) WriteCollectionHeader(extra string) (string, *XRError)
- func (jw *JsonWriter) WriteEmptyCollection(hasXref bool, extra string, eType int, collName string) string
- func (jw *JsonWriter) WriteEntity() *XRError
- func (jw *JsonWriter) WritePostCollections(hasXref bool, extra string, eType int) string
- func (jw *JsonWriter) WritePreCollections(hasXref bool, extra string, plural string, eType int) string
- type ManualVersionMode
- func (vm *ManualVersionMode) CheckAncestors(r *Resource) *XRError
- func (vm *ManualVersionMode) GetOrderedVersionIDs(r *Resource) ([]*VersionAncestor, *XRError)
- func (vm *ManualVersionMode) Name() string
- func (vm *ManualVersionMode) NewestVersionID(r *Resource) (string, *XRError)
- func (vm *ManualVersionMode) WillDelete(r *Resource, vID string) *XRError
- type MetaUpsert
- type PageWriter
- type RegOpt
- type RequestInfo
- func (info *RequestInfo) APIEnabled(name string) bool
- func (ri *RequestInfo) AddHeader(name, value string)
- func (info *RequestInfo) AddInline(path string) *XRError
- func (info *RequestInfo) DoDocView() bool
- func (info *RequestInfo) FlagEnabled(name string) bool
- func (info *RequestInfo) GetFlag(name string) string
- func (info *RequestInfo) GetFlagValues(name string) []string
- func (ri *RequestInfo) GetHeader(name string) string
- func (ri *RequestInfo) GetHeaderValues(name string) []string
- func (info *RequestInfo) GetParts(num int) string
- func (info *RequestInfo) HasFlag(name string) bool
- func (info *RequestInfo) HasIgnore(name string) bool
- func (info *RequestInfo) IsInlineSet(entityPath string) bool
- func (info *RequestInfo) ParseFilters() *XRError
- func (info *RequestInfo) ParseRegistryURL() *XRError
- func (info *RequestInfo) ParseRequestPath() *XRError
- func (info *RequestInfo) ParseRequestURL() *XRError
- func (ri *RequestInfo) SetHeader(name, value string)
- func (info *RequestInfo) ShouldInline(entityPath string) bool
- func (ri *RequestInfo) Write(b []byte) (int, error)
- type ResourceUpsert
- type Result
- type Server
- type Tx
- func (tx *Tx) AddGroup(g *Group)
- func (tx *Tx) AddMeta(m *Meta)
- func (tx *Tx) AddRegistry(r *Registry)
- func (tx *Tx) AddResource(r *Resource)
- func (tx *Tx) AddToCache(e *Entity)
- func (tx *Tx) AddVersion(v *Version)
- func (tx *Tx) Commit() *XRError
- func (tx *Tx) Conditional(xErr *XRError) *XRError
- func (tx *Tx) DumpCache()
- func (tx *Tx) EraseCache()
- func (tx *Tx) GetGroup(r *Registry, plural string, gID string) *Group
- func (tx *Tx) GetMeta(r *Resource) *Meta
- func (tx *Tx) GetRegistry(rID string) *Registry
- func (tx *Tx) GetResource(g *Group, plural string, rID string) *Resource
- func (tx *Tx) GetVersion(r *Resource, vID string) *Version
- func (tx *Tx) IsCacheDirty() bool
- func (tx *Tx) IsOpen() bool
- func (tx *Tx) NewTx() *XRError
- func (tx *Tx) Prepare(query string) (*sql.Stmt, *XRError)
- func (tx *Tx) RefreshFullTree()
- func (tx *Tx) RemoveFromCache(e *Entity)
- func (tx *Tx) Rollback() *XRError
- func (tx *Tx) SaveAllAndCommit() *XRError
- func (tx *Tx) SaveCommitRefresh() *XRError
- func (tx *Tx) String() string
- func (tx *Tx) Validate(info *RequestInfo)
- func (tx *Tx) WriteCache(force bool) *XRError
- type UserAttribute
- type UserGroupModel
- type UserModel
- type UserResourceModel
- type VersionAncestor
- type VersionMode
- type VersionUpsert
Constants ¶
const ( FILTER_PRESENT = iota + 1 FILTER_ABSENT FILTER_EQUAL FILTER_NOT_EQUAL )
const ( FOR_READ = iota + 1 FOR_WRITE )
For entity.AccessMode
const ANCESTOR_TBD = "$TBD"
const DOCVIEW_BASE = "#"
const HTML_EXP = "▾" // Expanded json symbol for HTML output
const HTML_MIN = "▸" // Minimized json symbol for HTML output
Variables ¶
var DB *sql.DB
var DBHOST = "localhost"
var DBPASSWORD = "password"
var DBPORT = "3306"
var DBUSER = "root"
var DB_InitFunc func()
var DB_Name = ""
var DefaultDiscardWriter = &DiscardWriter{}
var DefaultRegDbSID string
var MAX_PROPNAME = 255
var MAX_VARCHAR = 4096
var PProfFilter = &FilterPProf{}
var PropsFuncs = []*Attribute{ { Name: "specversion", // contains filtered or unexported fields }, { Name: "id", // contains filtered or unexported fields }, { Name: "versionid", // contains filtered or unexported fields }, { Name: "self", // contains filtered or unexported fields }, { Name: "xid", // contains filtered or unexported fields }, { Name: "xref", // contains filtered or unexported fields }, { Name: "epoch", // contains filtered or unexported fields }, { Name: "name", // contains filtered or unexported fields }, { Name: "isdefault", // contains filtered or unexported fields }, { Name: "description", // contains filtered or unexported fields }, { Name: "documentation", // contains filtered or unexported fields }, { Name: "labels", // contains filtered or unexported fields }, { Name: "createdat", // contains filtered or unexported fields }, { Name: "modifiedat", // contains filtered or unexported fields }, { Name: "$extensions", // contains filtered or unexported fields }, { Name: "capabilities", // contains filtered or unexported fields }, { Name: "model", // contains filtered or unexported fields }, { Name: "modelsource", // contains filtered or unexported fields }, { Name: "readonly", // contains filtered or unexported fields }, { Name: "compatibility", // contains filtered or unexported fields }, { Name: "compatibilityauthority", // contains filtered or unexported fields }, { Name: "deprecated", // contains filtered or unexported fields }, { Name: "ancestor", // contains filtered or unexported fields }, { Name: "contenttype", // contains filtered or unexported fields }, { Name: "$extensions", // contains filtered or unexported fields }, { Name: "$space", // contains filtered or unexported fields }, { Name: "$RESOURCEurl", // contains filtered or unexported fields }, { Name: "$RESOURCEproxyurl", // contains filtered or unexported fields }, { Name: "$RESOURCE", // contains filtered or unexported fields }, { Name: "$RESOURCEbase64", // contains filtered or unexported fields }, { Name: "$space", // contains filtered or unexported fields }, { Name: "metaurl", // contains filtered or unexported fields }, { Name: "meta", // contains filtered or unexported fields }, { Name: "$space", // contains filtered or unexported fields }, { Name: "defaultversionid", // contains filtered or unexported fields }, { Name: "defaultversionurl", // contains filtered or unexported fields }, { Name: "defaultversionsticky", // contains filtered or unexported fields }, { Name: "$space", // contains filtered or unexported fields }, { Name: "$COLLECTIONS", // contains filtered or unexported fields }, }
This data will be merged into OrderedSpecProps during init(). We can't put them directly into OrderedSpecProps because the client doesn't need them, or have access to the RequestInfo
var SupportedFormats = map[string]FormatChecker{}
var TXs = map[string]*Tx{}
Active transaction - mainly for debugging and testing
var TXsMutex = sync.RWMutex{}
var VersionModes = map[string]VersionMode{ "manual": (*ManualVersionMode)(nil), "createdat": (*CreatedatVersionMode)(nil), }
Functions ¶
func (*Entity) AddCalcProps ¶
func (e *Entity) AddCalcProps(info *RequestInfo) map[string]any
This will add in the calculated properties into the entity. This will normally be called after a query using FullTree view and before we serialize the entity we need to add the non-DB-stored properties (meaning, the calculated ones. Note that we make a copy and don't touch the entity itself. Serializing an entity shouldn't have side-effects.
func (*Registry) AddGroupWithObject ¶
func (*Group) AddResource ¶
func (*Group) AddResourceWithObject ¶
func (*Registry) AddToCache ¶
func (r *Registry) AddToCache(e *Entity)
ONLY CALL FROM TESTS - NEVER IN PROD
func (*Resource) AddVersion ¶
func (r *Resource) AddVersion(id string) (*Version, *XRError)
func (*Resource) AddVersionWithObject ¶
func (r *Resource) AddVersionWithObject(id string, obj Object) (*Version, *XRError)
func (*Model) ApplyNewModel ¶
func (m *Model) ApplyNewModel(newM *Model, src string) *XRError
func (*Model) ApplyNewModelFromJSON ¶
func (m *Model) ApplyNewModelFromJSON(buf []byte) *XRError
func BuildURL ¶
func BuildURL(info *RequestInfo, path string) string
func BuildURLNoUI ¶
func BuildURLNoUI(info *RequestInfo, path string) string
func (*Resource) CheckAncestors ¶
func (r *Resource) CheckAncestors() *XRError
func CheckAttrs ¶
We call this to verify that the top level attribute names are valid. We can't really do this during the Validation funcs because at that point in the process we may have added #xxx type of attribute names, and "#" isn't a valid char. And we need to make sure users don't try to pass in attributes that start with "#" to attack us. Now, one way around this is to move the system props (#xxx) into a separate map (out of Object and NewObject) but then we'd need to duplicate a lot of logic - but it might actually make for a cleaner design to keep system data out of the user data space, so worth considering in the future. I really would prefer to push this down in the stack though.
func (*Version) DeleteSetNextVersion ¶
func (v *Version) DeleteSetNextVersion(nextVersionID string) *XRError
func (*Resource) DumpOrderedVersions ¶
func (r *Resource) DumpOrderedVersions()
func DumpTimings ¶
func DumpTimings() string
func (*Resource) EnsureCircularReferences ¶
func (r *Resource) EnsureCircularReferences() *XRError
func (*Resource) EnsureCompat ¶
func (r *Resource) EnsureCompat() *XRError
func (*Resource) EnsureLatest ¶
func (r *Resource) EnsureLatest() *XRError
func (*Resource) EnsureMaxVersions ¶
func (r *Resource) EnsureMaxVersions() *XRError
func (*Entity) EnsureNewObject ¶
func (e *Entity) EnsureNewObject() bool
func (*Resource) EnsureSingleVersionRoot ¶
func (r *Resource) EnsureSingleVersionRoot() *XRError
func ExtractIncomingObject ¶
func ExtractIncomingObject(info *RequestInfo, body []byte) (Object, *XRError)
func FindRegistry ¶
BY UID
func FindRegistryBySID ¶
func (*Group) FindResource ¶
func (*Registry) FindResourceByXID ¶
func (*Resource) FindVersion ¶
Maybe replace error with a panic? same for other finds??
func (*Registry) FindXIDGroup ¶
func (*Registry) FindXIDMeta ¶
func (*Registry) FindXIDVersion ¶
func GenerateQuery ¶
func GenerateQuery(reg *Registry, what string, paths []string, filters [][]*FilterExpr, docView bool, sortKey string) (string, []interface{}, *XRError)
sortKey = attribute name, -NAME means descending, no "-" means ascending
func GenerateUI ¶
func GenerateUI(info *RequestInfo, data []byte) []byte
func (*Entity) GetAsString ¶
func (*Entity) GetAttributes ¶
func (e *Entity) GetAttributes(obj Object) Attributes
func (*Entity) GetBaseAttributes ¶
func (e *Entity) GetBaseAttributes() Attributes
Returns the initial set of attributes defined for the entity.
func (*Resource) GetChildVersionIDs ¶
func (*Version) GetChildren ¶
func (v *Version) GetChildren() ([]*Version, *XRError)
func (*Entity) GetCollections ¶
func (e *Entity) GetCollections() [][2]string
Array of plural/singular pairs
func (*Resource) GetDefault ¶
func (r *Resource) GetDefault(accessMode int) (*Version, *XRError)
Maybe replace error with a panic?
func GetDefaultReg ¶
func GetDefaultReg(tx *Tx) *Registry
func (*Entity) GetGroupModel ¶
func (e *Entity) GetGroupModel() *GroupModel
func GetGroupModelInlines ¶
func GetGroupModelInlines(gm *GroupModel) []string
func (*Resource) GetHasDocument ¶
func (r *Resource) GetHasDocument() bool
func (*Resource) GetNewestVersionID ¶
func (r *Resource) GetNewestVersionID() (string, *XRError)
func (*Resource) GetNumberOfVersions ¶
func (r *Resource) GetNumberOfVersions() (int, *XRError)
func (*Resource) GetOrderedVersionIDs ¶
func (r *Resource) GetOrderedVersionIDs() ([]*VersionAncestor, *XRError)
func (*Resource) GetProblematicVersions ¶
func (r *Resource) GetProblematicVersions() ([]*VersionAncestor, *XRError)
Return all versions whose 'ancestor' is ANCESTOR_TBD or points to a missing version (which include pointing to null). Note that the results is ordered so that we can process the ones with a missing Ancestor in oldest->newest order
func (*Entity) GetPropsOrdered ¶
func (e *Entity) GetPropsOrdered() ([]*Attribute, map[string]*Attribute)
func GetRegistryModelInlines ¶
func GetRegistryModelInlines(m *Model) []string
func GetRegistryNames ¶
func GetRegistryNames() ([]string, *XRError)
func (*Entity) GetRequestInfo ¶
func (e *Entity) GetRequestInfo() *RequestInfo
func (*Entity) GetResourceModel ¶
func (e *Entity) GetResourceModel() *ResourceModel
func GetResourceModelInlines ¶
func GetResourceModelInlines(rm *ResourceModel) []string
func (*Entity) GetResourceSingular ¶
func (e *Entity) GetResourceSingular() string
func (*Resource) GetRootVersionIDs ¶
func (r *Resource) GetRootVersionIDs() ([]string, *XRError)
func (*Resource) GetVersionIDs ¶
func (r *Resource) GetVersionIDs() ([]string, *XRError)
func (*Resource) GetVersionMode ¶
func (r *Resource) GetVersionMode() VersionMode
func GetVersionModelInlines ¶
func GetVersionModelInlines(rm *ResourceModel) []string
func GetVersionSum ¶
func GetVersionSum(version *Version) (int, *XRError)
func (*Resource) GetVersions ¶
func (r *Resource) GetVersions() ([]*Version, *XRError)
func GoToOurType ¶
func HTTPDelete ¶
func HTTPDelete(info *RequestInfo) *XRError
func HTTPDeleteGroups ¶
func HTTPDeleteGroups(info *RequestInfo) *XRError
func HTTPDeleteResources ¶
func HTTPDeleteResources(info *RequestInfo) *XRError
func HTTPDeleteVersions ¶
func HTTPDeleteVersions(info *RequestInfo) *XRError
func HTTPGETCapabilities ¶
func HTTPGETCapabilities(info *RequestInfo) *XRError
func HTTPGETCapabilitiesOffered ¶
func HTTPGETCapabilitiesOffered(info *RequestInfo) *XRError
func HTTPGETContent ¶
func HTTPGETContent(info *RequestInfo) *XRError
func HTTPGETModel ¶
func HTTPGETModel(info *RequestInfo) *XRError
func HTTPGETModelSource ¶
func HTTPGETModelSource(info *RequestInfo) *XRError
func HTTPGet ¶
func HTTPGet(info *RequestInfo) *XRError
func HTTPPUTCapabilities ¶
func HTTPPUTCapabilities(info *RequestInfo) *XRError
func HTTPPUTModelSource ¶
func HTTPPUTModelSource(info *RequestInfo) *XRError
func HTTPPutPost ¶
func HTTPPutPost(info *RequestInfo) *XRError
func HTTPWriteError ¶
func HTTPWriteError(info *RequestInfo, errAny any)
func (*Resource) HasCircularAncestors ¶
func (r *Resource) HasCircularAncestors() ([]string, *XRError)
func IsValidJson ¶
func (*Version) JustDelete ¶
func (v *Version) JustDelete() *XRError
JustDelete will delete the Version w/o any additional logic like "defaultversionid" manipulation. Used when xref on the Resource is set and we need to clear existing vers
func (*Resource) JustSetDefault ¶
func (*Resource) JustSetMeta ¶
func (*Registry) LoadCapabilities ¶
func (reg *Registry) LoadCapabilities() *Capabilities
func LoadEpochMap ¶
func LoadEpochMap(info *RequestInfo) (EpochEntryMap, *XRError)
func (*Registry) LoadModelFromFile ¶
func (reg *Registry) LoadModelFromFile(file string) *XRError
func LoadRemoteRegistry ¶
func LoadRemoteRegistry(host string) (*Registry, *XRError)
func (*Resource) MustFindMeta ¶
func NewRegistry ¶
func ParseRequest ¶
func ParseRequest(tx *Tx, w http.ResponseWriter, r *http.Request) (*RequestInfo, *XRError)
func Path2Abstract ¶
func PrepUpdateEntity ¶
func PrepUpdateEntity(e *Entity) *XRError
func ProcessSetDefaultVersionIDFlag ¶
func ProcessSetDefaultVersionIDFlag(info *RequestInfo, resource *Resource, version *Version) *XRError
Process the ?setdefaultversionid query parameter "resource" is the resource we're processing "version" is the version that was processed
func RawEntitiesFromQuery ¶
func RawEntityFromPath ¶
func (*Entity) Refresh ¶
func (e *Entity) Refresh(accessMode int) *XRError
Update the entity's Object - not the other props in Entity. Similar to RawEntityFromPath
func RegHTMLify ¶
HTML, # of expands
func RegisterFormat ¶
func RegisterFormat(name string, format FormatChecker)
func (*Entity) RemoveCollections ¶
func (e *Entity) RemoveCollections(obj Object)
This will remove all Collection related attributes from the entity. While this is an Entity.Func, we allow callers to pass in the Object data to use instead of the e.Object/NewObject so that we'll use this Entity's Type (which tells us which collections it has), on the 'obj'. This is handy for cases where we need to remove the Resource's collections from a Version's Object - like on a PUT to /GROUPs/gID/RESOURECEs/rID where we're passing in what looks like a Resource entity, but we're really using it to create a Version
func RemoveResourceAttributes ¶
Remove any attributes that appear on Resources but not Versions. Mainly used to prep an Obj that was directed at a Resource but will be used to update a Version
func RemoveVersionAttributes ¶
Not used yet but if we ever support extensions for resourceattributes then we may need this
func ReplaceVariables ¶
func (*Registry) SaveAllAndCommit ¶
func (r *Registry) SaveAllAndCommit() *XRError
func (*Registry) SaveCommitRefresh ¶
func (r *Registry) SaveCommitRefresh() *XRError
ONLY CALL FROM TESTS - NEVER IN PROD
func (*Model) SerializeForUser ¶
func (m *Model) SerializeForUser() ([]byte, *XRError)
func (*Entity) SerializeProps ¶
func (e *Entity) SerializeProps(info *RequestInfo, fn func(*Entity, *RequestInfo, string, any, *Attribute) *XRError) *XRError
This is used to serialize an Entity regardless of the format. This will:
- Use AddCalcProps() to fill in any missing props (eg Entity's getFn())
- Call that passed-in 'fn' to serialize each prop but in the right order as defined by the entity's GetPropsOrdered()
func SerializeQuery ¶
func SerializeQuery(info *RequestInfo, resPaths map[string][]string, what string, filters [][]*FilterExpr) *XRError
func SerializeResourceContents ¶
func SerializeResourceContents(jw *JsonWriter, e *Entity, info *RequestInfo, extra *string) *XRError
func (*Entity) SetDBProperty ¶
func (e *Entity) SetDBProperty(pp *PropPath, val any) *XRError
This will save a single property/value in the DB. This assumes the caller is traversing the Object and splitting it into individual props
func (*Resource) SetDefault ¶
func (r *Resource) SetDefault(newDefault *Version) *XRError
Only call this if you want things to be sticky (when not nil). Creating a new version should do this directly
func (*Resource) SetDefaultID ¶
func (r *Resource) SetDefaultID(vID string) *XRError
Note will set sticky if vID != ""
func (*Entity) SetFromDBName ¶
This is used to take a DB entry and update the current Entity's Object
func (*Entity) SetNewObject ¶
We use this just to make sure we can set NewObjectStack when we need to debug stuff
func (*Entity) SetPP ¶
func (e *Entity) SetPP(pp *PropPath, val any) *XRError
This is really just an internal Setter used for testing. It'll set a property and then validate and save the entity in the DB
func (*Resource) SetSaveDefault ¶
func (*Resource) SetSaveMeta ¶
func (*Resource) SetSaveResource ¶
Should only ever be used for "id"
func (*Registry) UpsertGroup ¶
*Group, isNew, error
func (*Registry) UpsertGroupWithObject ¶
func (*Resource) UpsertMeta ¶
func (r *Resource) UpsertMeta(mu *MetaUpsert) (*Meta, bool, *XRError)
returns *Meta, isNew, error "createVersion" means we should create a version if there isn't already one there. This will only happen when the client talks directly to "meta" w/o the surrounding Resource object. AND, for now, we only do it when we're removing the 'xref' attr. Other cases, the http layer would have already create the Resource and default version for us.
func (*Group) UpsertResource ¶
func (g *Group) UpsertResource(ru *ResourceUpsert) (*Resource, bool, *XRError)
Return: *Resource, isNew, error
func (*Resource) UpsertVersion ¶
func (*Resource) UpsertVersionWithObject ¶
func (r *Resource) UpsertVersionWithObject(vu *VersionUpsert) (*Version, bool, *XRError)
*Version, isNew, error
func (*Model) UserMarshal ¶
func (*Entity) Validate ¶
func (e *Entity) Validate() *XRError
Doesn't fully validate in the sense that it'll assume read-only fields are not worth checking since the server generated them. This is mainly used for validating input from a client. NOTE!!! This isn't a read-only operation. Normally it would be, but to avoid traversing the entity more than once, we will tweak things if needed. For example, if a missing attribute has a Default value then we'll add it.
func (*Entity) ValidateAndSave ¶
func (e *Entity) ValidateAndSave() *XRError
func (*Entity) ValidateArray ¶
func (e *Entity) ValidateArray(arrayAttr *Attribute, val any, path *PropPath) *XRError
func (*Entity) ValidateAttribute ¶
Return: error, haveReplaceValue, newValue
func (*Entity) ValidateMap ¶
func (e *Entity) ValidateMap(val any, item *Item, path *PropPath) *XRError
func (*Entity) ValidateObject ¶
func (e *Entity) ValidateObject(val any, namecharset string, origAttrs Attributes, path *PropPath) *XRError
This should be called after all type-specific calculated properties have been removed - such as collections
func (*Resource) ValidateResource ¶
func (r *Resource) ValidateResource(onlyMetaChanged bool) *XRError
Run all constrait check on the Resource - see:
spec.md#resource-processing-algorithm
func (*Entity) ValidateScalar ¶
returns: Error, haveReplacementValue, replacementValue
func (*Model) VerifyAndSave ¶
func (m *Model) VerifyAndSave() *XRError
VerifyAndSave() should be called by automatically but there may be cases where someone would need to call it manually (e.g. setting an attribute's property - we should technically find a way to catch those cases so code above this shouldn't need to think about it
func (*ResourceModel) VerifyData ¶
func (rm *ResourceModel) VerifyData() *XRError
func (*Entity) WasTouched ¶
func (e *Entity) WasTouched() bool
func WildcardIt ¶
func (*Resource) WillDelete ¶
func (r *Resource) WillDelete(vID string) *XRError
func (*Registry) XID2Entity ¶
Types ¶
type BufferedWriter ¶
type BufferedWriter struct {
Info *RequestInfo
OldWriter HTTPWriter
Headers *map[string][]string
Buffer *bytes.Buffer
}
func NewBufferedWriter ¶
func NewBufferedWriter(info *RequestInfo) *BufferedWriter
func (*BufferedWriter) AddHeader ¶
func (bw *BufferedWriter) AddHeader(name, value string)
func (*BufferedWriter) Done ¶
func (bw *BufferedWriter) Done()
func (*BufferedWriter) GetHeader ¶
func (bw *BufferedWriter) GetHeader(name string) string
func (*BufferedWriter) GetHeaderValues ¶
func (bw *BufferedWriter) GetHeaderValues(name string) []string
func (*BufferedWriter) SetHeader ¶
func (bw *BufferedWriter) SetHeader(name, value string)
type CreatedatVersionMode ¶
type CreatedatVersionMode struct{}
func (*CreatedatVersionMode) CheckAncestors ¶
func (vm *CreatedatVersionMode) CheckAncestors(r *Resource) *XRError
func (*CreatedatVersionMode) GetOrderedVersionIDs ¶
func (vm *CreatedatVersionMode) GetOrderedVersionIDs(r *Resource) ([]*VersionAncestor, *XRError)
func (*CreatedatVersionMode) Name ¶
func (vm *CreatedatVersionMode) Name() string
func (*CreatedatVersionMode) NewestVersionID ¶
func (vm *CreatedatVersionMode) NewestVersionID(r *Resource) (string, *XRError)
func (*CreatedatVersionMode) WillDelete ¶
func (vm *CreatedatVersionMode) WillDelete(r *Resource, vID string) *XRError
type DefaultWriter ¶
type DefaultWriter struct {
Info *RequestInfo
}
func (*DefaultWriter) AddHeader ¶
func (dw *DefaultWriter) AddHeader(name string, value string)
func (*DefaultWriter) Done ¶
func (dw *DefaultWriter) Done()
func (*DefaultWriter) GetHeader ¶
func (dw *DefaultWriter) GetHeader(name string) string
func (*DefaultWriter) GetHeaderValues ¶
func (dw *DefaultWriter) GetHeaderValues(name string) []string
func (*DefaultWriter) SetHeader ¶
func (dw *DefaultWriter) SetHeader(name, value string)
type DiscardWriter ¶
type DiscardWriter struct{}
func (*DiscardWriter) AddHeader ¶
func (dw *DiscardWriter) AddHeader(name, value string)
func (*DiscardWriter) Done ¶
func (dw *DiscardWriter) Done()
func (*DiscardWriter) GetHeader ¶
func (dw *DiscardWriter) GetHeader(name string) string
func (*DiscardWriter) GetHeaderValues ¶
func (dw *DiscardWriter) GetHeaderValues(name string) []string
func (*DiscardWriter) SetHeader ¶
func (dw *DiscardWriter) SetHeader(name, value string)
type EntityExtensions ¶
type EntityExtensions struct {
AccessMode int // FOR_READ, FOR_WRITE
// contains filtered or unexported fields
}
type EntitySetter ¶
type EpochEntry ¶
type EpochEntryMap ¶
type EpochEntryMap map[string]EpochEntry
type FilterExpr ¶
type FilterPProf ¶
type FilterPProf struct {
// contains filtered or unexported fields
}
type FormatChecker ¶
type FormatChecker interface {
IsValid(version *Version) *XRError
IsCompatible(oldVersion, newVersion *Version) *XRError
}
type FormatJson ¶
type FormatJson struct{}
func (FormatJson) IsCompatible ¶
func (fp FormatJson) IsCompatible(oldVersion *Version, newVersion *Version) *XRError
func (FormatJson) IsValid ¶
func (fp FormatJson) IsValid(version *Version) *XRError
type FormatNumbers ¶
type FormatNumbers struct{}
func (FormatNumbers) IsCompatible ¶
func (ft FormatNumbers) IsCompatible(oldVersion, newVersion *Version) *XRError
func (FormatNumbers) IsValid ¶
func (ft FormatNumbers) IsValid(version *Version) *XRError
type FormatProtobuf ¶
type FormatProtobuf struct{}
func (FormatProtobuf) IsCompatible ¶
func (fp FormatProtobuf) IsCompatible(oldVersion *Version, newVersion *Version) *XRError
checks if both buffers are valid Protobuf schemas and whether newBuf is backwards compatible with oldBuf according to Protobuf wire compatibility rules.
func (FormatProtobuf) IsValid ¶
func (fp FormatProtobuf) IsValid(version *Version) *XRError
IsValid checks if the version is a valid Protobuf schema syntax
type HTTPWriter ¶
type HTTPWriter interface {
Write([]byte) (int, error)
SetHeader(string, string)
AddHeader(string, string)
GetHeader(string) string
GetHeaderValues(string) []string
Done()
}
func DefaultHTTPWriter ¶
func DefaultHTTPWriter(info *RequestInfo) HTTPWriter
type Inline ¶
type Inline struct {
Path string // value from ?inline query param
PP *PropPath // PP for 'value'
NonWild *PropPath // PP for value w/o .* if present, else nil
}
type JsonWriter ¶
type JsonWriter struct {
Entity *Entity // Current row in the DB results
// contains filtered or unexported fields
}
func NewJsonWriter ¶
func NewJsonWriter(info *RequestInfo, results *Result) *JsonWriter
func (*JsonWriter) Indent ¶
func (jw *JsonWriter) Indent()
func (*JsonWriter) LoadCollections ¶
func (jw *JsonWriter) LoadCollections(eType int)
func (*JsonWriter) NextEntity ¶
func (jw *JsonWriter) NextEntity() (*Entity, *XRError)
func (*JsonWriter) OptPrintf ¶
func (jw *JsonWriter) OptPrintf(format string, args ...any)
func (*JsonWriter) Outdent ¶
func (jw *JsonWriter) Outdent()
func (*JsonWriter) Pop ¶
func (jw *JsonWriter) Pop() *Entity
func (*JsonWriter) Print ¶
func (jw *JsonWriter) Print(str string)
func (*JsonWriter) Printf ¶
func (jw *JsonWriter) Printf(format string, args ...any)
func (*JsonWriter) Push ¶
func (jw *JsonWriter) Push(e *Entity)
func (*JsonWriter) WriteCollection ¶
func (jw *JsonWriter) WriteCollection() (int, *XRError)
func (*JsonWriter) WriteCollectionHeader ¶
func (jw *JsonWriter) WriteCollectionHeader(extra string) (string, *XRError)
This is called WriteCollectionHeaders because it doesn't just write the collection, it also writes the COLLECTIONSurl and COLLECTIONscount headers/attributes. WriteCollection will do the actual processing of the entities in there.
func (*JsonWriter) WriteEmptyCollection ¶
func (*JsonWriter) WriteEntity ¶
func (jw *JsonWriter) WriteEntity() *XRError
func (*JsonWriter) WritePostCollections ¶
func (jw *JsonWriter) WritePostCollections(hasXref bool, extra string, eType int) string
func (*JsonWriter) WritePreCollections ¶
type ManualVersionMode ¶
type ManualVersionMode struct{}
func (*ManualVersionMode) CheckAncestors ¶
func (vm *ManualVersionMode) CheckAncestors(r *Resource) *XRError
func (*ManualVersionMode) GetOrderedVersionIDs ¶
func (vm *ManualVersionMode) GetOrderedVersionIDs(r *Resource) ([]*VersionAncestor, *XRError)
func (*ManualVersionMode) Name ¶
func (vm *ManualVersionMode) Name() string
func (*ManualVersionMode) NewestVersionID ¶
func (vm *ManualVersionMode) NewestVersionID(r *Resource) (string, *XRError)
func (*ManualVersionMode) WillDelete ¶
func (vm *ManualVersionMode) WillDelete(r *Resource, vID string) *XRError
type MetaUpsert ¶
type MetaUpsert struct {
// contains filtered or unexported fields
}
type PageWriter ¶
type PageWriter struct {
Info *RequestInfo
OldWriter HTTPWriter
Headers *map[string][]string
Buffer *bytes.Buffer
}
func NewPageWriter ¶
func NewPageWriter(info *RequestInfo) *PageWriter
func (*PageWriter) AddHeader ¶
func (pw *PageWriter) AddHeader(name, value string)
func (*PageWriter) Done ¶
func (pw *PageWriter) Done()
func (*PageWriter) GetHeader ¶
func (pw *PageWriter) GetHeader(name string) string
func (*PageWriter) GetHeaderValues ¶
func (pw *PageWriter) GetHeaderValues(name string) []string
func (*PageWriter) SetHeader ¶
func (pw *PageWriter) SetHeader(name, value string)
type RequestInfo ¶
type RequestInfo struct {
Registry *Registry
BaseURL string // host+path to root of registry
OriginalPath string // /GROUPs/gID...?inline...
OriginalRequest *http.Request `json:"-"`
OriginalResponse http.ResponseWriter `json:"-"`
RootPath string // "", "model", "export", ...
Parts []string // Split /GROUPS/gID of OriginalPath
Root string // GROUPS/gID/..
Abstract string // /GROUPS/RESOUCES (no IDs)
GroupType string
GroupUID string
GroupModel *GroupModel
ResourceType string
ResourceUID string
ResourceModel *ResourceModel
VersionUID string
What string // Registry, Coll, Entity
Flags map[string]string // Query params (and str value, if there)
Ignores map[string]bool // key=ignore-value
Inlines []*Inline
Filters [][]*FilterExpr // [OR][AND] filter=e,e(and) &(or) filter=e
ShowDetails bool // is $details present
SortKey string // [-]AttrName - => descending
StatusCode int
SentStatus bool
HTTPWriter HTTPWriter `json:"-"`
ProxyHost string
ProxyPath string
// contains filtered or unexported fields
}
func NewRequestInfo ¶
func NewRequestInfo(w http.ResponseWriter, r *http.Request) *RequestInfo
func (*RequestInfo) APIEnabled ¶
func (info *RequestInfo) APIEnabled(name string) bool
func (*RequestInfo) AddHeader ¶
func (ri *RequestInfo) AddHeader(name, value string)
func (*RequestInfo) AddInline ¶
func (info *RequestInfo) AddInline(path string) *XRError
func (*RequestInfo) DoDocView ¶
func (info *RequestInfo) DoDocView() bool
func (*RequestInfo) FlagEnabled ¶
func (info *RequestInfo) FlagEnabled(name string) bool
func (*RequestInfo) GetFlag ¶
func (info *RequestInfo) GetFlag(name string) string
Get query parameter value
func (*RequestInfo) GetFlagValues ¶
func (info *RequestInfo) GetFlagValues(name string) []string
func (*RequestInfo) GetHeader ¶
func (ri *RequestInfo) GetHeader(name string) string
func (*RequestInfo) GetHeaderValues ¶
func (ri *RequestInfo) GetHeaderValues(name string) []string
func (*RequestInfo) GetParts ¶
func (info *RequestInfo) GetParts(num int) string
func (*RequestInfo) HasFlag ¶
func (info *RequestInfo) HasFlag(name string) bool
func (*RequestInfo) HasIgnore ¶
func (info *RequestInfo) HasIgnore(name string) bool
func (*RequestInfo) IsInlineSet ¶
func (info *RequestInfo) IsInlineSet(entityPath string) bool
func (*RequestInfo) ParseFilters ¶
func (info *RequestInfo) ParseFilters() *XRError
func (*RequestInfo) ParseRegistryURL ¶
func (info *RequestInfo) ParseRegistryURL() *XRError
This will extract the "reg-xxx" part of the URL if there and choose the appropriate Registry to use. It'll update info's BaseURL based on reg- This will populate some initial stuff in the "info" struct too, like Registry.
func (*RequestInfo) ParseRequestPath ¶
func (info *RequestInfo) ParseRequestPath() *XRError
func (*RequestInfo) ParseRequestURL ¶
func (info *RequestInfo) ParseRequestURL() *XRError
func (*RequestInfo) SetHeader ¶
func (ri *RequestInfo) SetHeader(name, value string)
func (*RequestInfo) ShouldInline ¶
func (info *RequestInfo) ShouldInline(entityPath string) bool
type ResourceUpsert ¶
type Result ¶
type Result struct {
Data []*any // One row
TempData []any
Reuse bool
AllRows [][]*any
// contains filtered or unexported fields
}
func (*Result) PullNextRow ¶
func (r *Result) PullNextRow()
func (*Result) RetrieveAllRowsFromDB ¶
func (r *Result) RetrieveAllRowsFromDB()
func (*Result) RetrieveNextRowFromDB ¶
type Tx ¶
type Tx struct {
Registry *Registry
CreateTime string // use for entity timestamps too
User string
RequestInfo *RequestInfo
ClearFullTree bool
// Cache of entities this Tx is dealing with. Things can get funky if
// we have more than one instance of the same entity in memory.
// TODO DUG expand this to save all types, not just Versions.
// Also, consider having Commit() just automatically call ValidateAndSave
// for all entities in the Tx - then people don't need to call save
// explicitly
Cache map[string]*Entity // e.Path
// contains filtered or unexported fields
}
Holds info about the current transaction. In a lot of ways this is similar to golang's Context in that it holds other info related to the current changes that are going on. Maybe one day convert this to a Context where Tx is just as apsect of it.
func (*Tx) AddRegistry ¶
func (tx *Tx) AddRegistry(r *Registry)
func (*Tx) AddResource ¶
func (tx *Tx) AddResource(r *Resource)
func (*Tx) AddToCache ¶
func (tx *Tx) AddToCache(e *Entity)
func (*Tx) AddVersion ¶
func (tx *Tx) AddVersion(v *Version)
func (*Tx) Conditional ¶
func (tx *Tx) Conditional(xErr *XRError) *XRError
func (*Tx) EraseCache ¶
func (tx *Tx) EraseCache()
func (*Tx) GetRegistry ¶
func (*Tx) GetResource ¶
func (*Tx) GetVersion ¶
func (*Tx) IsCacheDirty ¶
func (*Tx) NewTx ¶
func (tx *Tx) NewTx() *XRError
It's ok for this to be called multiple times for the same Tx just to make sure we have an active transaction - it's a no-op at that point
func (*Tx) RefreshFullTree ¶
func (tx *Tx) RefreshFullTree()
func (*Tx) RemoveFromCache ¶
func (tx *Tx) RemoveFromCache(e *Entity)
func (*Tx) SaveAllAndCommit ¶
func (tx *Tx) SaveAllAndCommit() *XRError
func (*Tx) Validate ¶
func (tx *Tx) Validate(info *RequestInfo)
func (*Tx) WriteCache ¶
type UserAttribute ¶
type UserAttribute Attribute
func (*UserAttribute) MarshalJSON ¶
func (ua *UserAttribute) MarshalJSON() ([]byte, error)
type UserGroupModel ¶
type UserGroupModel GroupModel
func (*UserGroupModel) MarshalJSON ¶
func (ug *UserGroupModel) MarshalJSON() ([]byte, error)
type UserResourceModel ¶
type UserResourceModel ResourceModel
func (*UserResourceModel) MarshalJSON ¶
func (ur *UserResourceModel) MarshalJSON() ([]byte, error)
type VersionAncestor ¶
type VersionMode ¶
type VersionMode interface {
Name() string
CheckAncestors(r *Resource) *XRError
NewestVersionID(r *Resource) (string, *XRError)
WillDelete(r *Resource, vID string) *XRError
GetOrderedVersionIDs(r *Resource) ([]*VersionAncestor, *XRError)
}