github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/domain/runtime_context/entity.go (about)

     1  package runtimectx
     2  
     3  import "github.com/kyma-incubator/compass/components/director/pkg/resource"
     4  
     5  // RuntimeContext struct represents database entity for RuntimeContext
     6  type RuntimeContext struct {
     7  	ID        string `db:"id"`
     8  	RuntimeID string `db:"runtime_id"`
     9  	Key       string `db:"key"`
    10  	Value     string `db:"value"`
    11  }
    12  
    13  // GetID returns ID of RuntimeContext
    14  func (e *RuntimeContext) GetID() string {
    15  	return e.ID
    16  }
    17  
    18  // GetParent returns the parent type and the parent ID of the entity.
    19  func (e *RuntimeContext) GetParent(_ resource.Type) (resource.Type, string) {
    20  	return resource.Runtime, e.RuntimeID
    21  }
    22  
    23  // DecorateWithTenantID decorates the entity with the given tenant ID.
    24  func (e *RuntimeContext) DecorateWithTenantID(tenant string) interface{} {
    25  	return struct {
    26  		*RuntimeContext
    27  		TenantID string `db:"tenant_id"`
    28  	}{
    29  		RuntimeContext: e,
    30  		TenantID:       tenant,
    31  	}
    32  }