github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/appdef/interface_structure.go (about) 1 /* 2 * Copyright (c) 2021-present Sigma-Soft, Ltd. 3 * @author: Nikolay Nikitin 4 */ 5 6 package appdef 7 8 // Structure is a type with fields, containers and uniques. 9 type IStructure interface { 10 IType 11 IFields 12 IContainers 13 IUniques 14 IWithAbstract 15 16 // Returns definition for «sys.QName» field 17 SystemField_QName() IField 18 } 19 20 type IStructureBuilder interface { 21 ITypeBuilder 22 IFieldsBuilder 23 IContainersBuilder 24 IUniquesBuilder 25 IWithAbstractBuilder 26 } 27 28 type IWithStructures interface { 29 // Return structure by name. 30 // 31 // Returns nil if not found. 32 Structure(QName) IStructure 33 34 // Enumerates all application structures 35 // 36 // Structures are enumerated in alphabetical order by QName 37 Structures(func(IStructure)) 38 } 39 40 // Record is a structure. 41 // 42 // Record has ID field. 43 type IRecord interface { 44 IStructure 45 46 // Returns definition for «sys.ID» field 47 SystemField_ID() IField 48 } 49 50 type IRecordBuilder interface { 51 IStructureBuilder 52 } 53 54 type IWithRecords interface { 55 // Return record by name. 56 // 57 // Returns nil if not found. 58 Record(QName) IRecord 59 60 // Enumerates all application records, e.g. documents and contained records 61 // 62 // Records are enumerated in alphabetical order by QName 63 Records(func(IRecord)) 64 } 65 66 // Document is a record. 67 // 68 // Document can contains records. 69 type IDoc interface { 70 IRecord 71 72 // Unwanted type assertion stub 73 isDoc() 74 } 75 76 type IDocBuilder interface { 77 IRecordBuilder 78 } 79 80 // Contained record is a record that has parent. 81 type IContainedRecord interface { 82 IRecord 83 84 // Returns definition for «sys.ParentID» field 85 SystemField_ParentID() IField 86 87 // Returns definition for «sys.Container» field 88 SystemField_Container() IField 89 } 90 91 type IContainedRecordBuilder interface { 92 IRecordBuilder 93 }