github.com/vescale/zgraph@v0.0.0-20230410094002-959c02d50f95/catalog/label.go (about)

     1  // Copyright 2022 zGraph Authors. All rights reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package catalog
    16  
    17  import (
    18  	"sync"
    19  
    20  	"github.com/vescale/zgraph/parser/model"
    21  )
    22  
    23  // Label represents a runtime label object.
    24  type Label struct {
    25  	mu sync.RWMutex
    26  
    27  	meta *model.LabelInfo
    28  }
    29  
    30  // NewLabel returns a label instance.
    31  func NewLabel(meta *model.LabelInfo) *Label {
    32  	l := &Label{
    33  		meta: meta,
    34  	}
    35  	return l
    36  }
    37  
    38  // Meta returns the meta information object of this label.
    39  func (l *Label) Meta() *model.LabelInfo {
    40  	return l.meta
    41  }