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

     1  /*
     2   * Copyright (c) 2021-present Sigma-Soft, Ltd.
     3   * @author: Nikolay Nikitin
     4   */
     5  
     6  package appdef
     7  
     8  // Configuration document.
     9  type ICDoc interface {
    10  	ISingleton
    11  
    12  	// Unwanted type assertion stub
    13  	isCDoc()
    14  }
    15  
    16  type ICDocBuilder interface {
    17  	ISingletonBuilder
    18  }
    19  
    20  // Configuration document record.
    21  type ICRecord interface {
    22  	IContainedRecord
    23  
    24  	// Unwanted type assertion stub
    25  	isCRecord()
    26  }
    27  
    28  type ICRecordBuilder interface {
    29  	IContainedRecordBuilder
    30  }
    31  
    32  type IWithCDocs interface {
    33  	// Return CDoc by name.
    34  	//
    35  	// Returns nil if not found.
    36  	CDoc(name QName) ICDoc
    37  
    38  	// Return CRecord by name.
    39  	//
    40  	// Returns nil if not found.
    41  	CRecord(name QName) ICRecord
    42  
    43  	// Enumerates all application configuration documents
    44  	//
    45  	// Configuration documents are enumerated in alphabetical order by QName
    46  	CDocs(func(ICDoc))
    47  
    48  	// Enumerates all application configuration records
    49  	//
    50  	// Configuration records are enumerated in alphabetical order by QName
    51  	CRecords(func(ICRecord))
    52  }
    53  
    54  type ICDocsBuilder interface {
    55  	// Adds new CDoc 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  	AddCDoc(name QName) ICDocBuilder
    62  
    63  	// Adds new CRecord 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  	AddCRecord(name QName) ICRecordBuilder
    70  }