github.com/mineiros-io/terradoc@v0.0.9-0.20220711062319-018bd4ae81f5/internal/entities/output.go (about)

     1  package entities
     2  
     3  // Output represents an `output` block from the input file.
     4  type Output struct {
     5  	// Name as defined in the `output` block label.
     6  	Name string `json:"name"`
     7  	// Type is a type definition for the output
     8  	Type Type `json:"type_definition"`
     9  	// Description is an optional output description
    10  	Description string `json:"description,omitempty"`
    11  }
    12  
    13  type OutputCollection []Output
    14  
    15  func (oc OutputCollection) OutputByName(name string) (Output, bool) {
    16  	for _, o := range oc {
    17  		if o.Name == name {
    18  			return o, true
    19  		}
    20  	}
    21  
    22  	return Output{}, false
    23  }