mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 01:41:44 +00:00
feature/1214 session fetch refactor (#1215)
* chore(docs): remove token economy guide * refactor(context): update GatewayContext to use Querier interface * chore(database): update schema path * docs: Update READMEs for x/did, x/dwn, and x/svc with UCAN integration * chore(pkg): update database scope name * refactor(did): optimize GenesisState proto methods * refactor(svc): update Service proto to use repeated fields * refactor(api): rename MsgSpawn to MsgInitialize
This commit is contained in:
@@ -43,3 +43,64 @@ func (gs GenesisState) Validate() error {
|
||||
|
||||
return gs.Params.Validate()
|
||||
}
|
||||
|
||||
// Equal checks if two Attenuation are equal
|
||||
func (a *Attenuation) Equal(that *Attenuation) bool {
|
||||
if that == nil {
|
||||
return false
|
||||
}
|
||||
if a.Resource != nil {
|
||||
if that.Resource == nil {
|
||||
return false
|
||||
}
|
||||
if !a.Resource.Equal(that.Resource) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(a.Capabilities) != len(that.Capabilities) {
|
||||
return false
|
||||
}
|
||||
for i := range a.Capabilities {
|
||||
if !a.Capabilities[i].Equal(that.Capabilities[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Equal checks if two Capability are equal
|
||||
func (c *Capability) Equal(that *Capability) bool {
|
||||
if that == nil {
|
||||
return false
|
||||
}
|
||||
if c.Name != that.Name {
|
||||
return false
|
||||
}
|
||||
if c.Parent != that.Parent {
|
||||
return false
|
||||
}
|
||||
// TODO: check description
|
||||
if len(c.Resources) != len(that.Resources) {
|
||||
return false
|
||||
}
|
||||
for i := range c.Resources {
|
||||
if c.Resources[i] != that.Resources[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Equal checks if two Resource are equal
|
||||
func (r *Resource) Equal(that *Resource) bool {
|
||||
if that == nil {
|
||||
return false
|
||||
}
|
||||
if r.Kind != that.Kind {
|
||||
return false
|
||||
}
|
||||
if r.Template != that.Template {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
+1015
-145
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user