github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/appdef/interface_gdoc.go (about)

     1  /*
     2   * Copyright (c) 2021-present Sigma-Soft, Ltd.
     3   * @author: Nikolay Nikitin
     4   */
     5  
     6  package appdef
     7  
     8  // Global document.
     9  type IGDoc interface {
    10  	IDoc
    11  
    12  	// unwanted type assertion stub
    13  	isGDoc()
    14  }
    15  
    16  type IGDocBuilder interface {
    17  	IDocBuilder
    18  }
    19  
    20  // Global document record.
    21  type IGRecord interface {
    22  	IContainedRecord
    23  
    24  	// unwanted type assertion stub
    25  	isGRecord()
    26  }
    27  
    28  type IGRecordBuilder interface {
    29  	IContainedRecordBuilder
    30  }
    31  
    32  type IWithGDocs interface {
    33  	// Return GDoc by name.
    34  	//
    35  	// Returns nil if not found.
    36  	GDoc(QName) IGDoc
    37  
    38  	// Enumerates all global documents
    39  	//
    40  	// Global documents are enumerated in alphabetical order by QName
    41  	GDocs(func(IGDoc))
    42  
    43  	// Return GRecord by name.
    44  	//
    45  	// Returns nil if not found.
    46  	GRecord(QName) IGRecord
    47  
    48  	// Enumerates all global records
    49  	//
    50  	// Global records are enumerated in alphabetical order by QName
    51  	GRecords(func(IGRecord))
    52  }
    53  
    54  type IGDocsBuilder interface {
    55  	// Adds new GDoc type with specified name.
    56  	//
    57  	// # Panics:
    58  	//   - if name is empty (appdef.NullQName),
    59  	//   - if name is invalid,
    60  	//   - if type with name already exists.
    61  	AddGDoc(QName) IGDocBuilder
    62  
    63  	// Adds new GRecord type with specified name.
    64  	//
    65  	// # Panics:
    66  	//   - if name is empty (appdef.NullQName),
    67  	//   - if name is invalid,
    68  	//   - if type with name already exists.
    69  	AddGRecord(QName) IGRecordBuilder
    70  }