github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/specobj/specobj.go (about)

     1  package specobj
     2  
     3  import (
     4  	magic "github.com/metux/go-magicdict"
     5  	"github.com/metux/go-magicdict/api"
     6  )
     7  
     8  type Key = magic.Key
     9  type Entry = magic.Entry
    10  
    11  type SpecObj struct {
    12  	Spec Entry
    13  	Err  error
    14  }
    15  
    16  func (so SpecObj) MyKey() Key {
    17  	return Key(so.EntryStr(api.MagicAttrKey))
    18  }
    19  
    20  func NewSpecObj(ent magic.Entry) SpecObj {
    21  	return SpecObj{ent, nil}
    22  }
    23  
    24  func NewSpecObjErr(ent magic.Entry, err error) SpecObj {
    25  	return SpecObj{ent, err}
    26  }