-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta,args: add missing Include, add iterator to use normal or Readonl…
…y the same way
- Loading branch information
1 parent
4ec409e
commit 4779da6
Showing
5 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,60 @@ | ||
package meta | ||
|
||
import ( | ||
"iter" | ||
|
||
"github.com/ipld/go-ipld-prime" | ||
) | ||
|
||
// ReadOnly wraps a Meta into a read-only facade. | ||
type ReadOnly struct { | ||
m *Meta | ||
meta *Meta | ||
} | ||
|
||
func (r ReadOnly) GetBool(key string) (bool, error) { | ||
return r.m.GetBool(key) | ||
return r.meta.GetBool(key) | ||
} | ||
|
||
func (r ReadOnly) GetString(key string) (string, error) { | ||
return r.m.GetString(key) | ||
return r.meta.GetString(key) | ||
} | ||
|
||
func (r ReadOnly) GetEncryptedString(key string, encryptionKey []byte) (string, error) { | ||
return r.m.GetEncryptedString(key, encryptionKey) | ||
return r.meta.GetEncryptedString(key, encryptionKey) | ||
} | ||
|
||
func (r ReadOnly) GetInt64(key string) (int64, error) { | ||
return r.m.GetInt64(key) | ||
return r.meta.GetInt64(key) | ||
} | ||
|
||
func (r ReadOnly) GetFloat64(key string) (float64, error) { | ||
return r.m.GetFloat64(key) | ||
return r.meta.GetFloat64(key) | ||
} | ||
|
||
func (r ReadOnly) GetBytes(key string) ([]byte, error) { | ||
return r.m.GetBytes(key) | ||
return r.meta.GetBytes(key) | ||
} | ||
|
||
func (r ReadOnly) GetEncryptedBytes(key string, encryptionKey []byte) ([]byte, error) { | ||
return r.m.GetEncryptedBytes(key, encryptionKey) | ||
return r.meta.GetEncryptedBytes(key, encryptionKey) | ||
} | ||
|
||
func (r ReadOnly) GetNode(key string) (ipld.Node, error) { | ||
return r.m.GetNode(key) | ||
return r.meta.GetNode(key) | ||
} | ||
|
||
func (r ReadOnly) Iter() iter.Seq2[string, ipld.Node] { | ||
return r.meta.Iter() | ||
} | ||
|
||
func (r ReadOnly) Equals(other ReadOnly) bool { | ||
return r.m.Equals(other.m) | ||
return r.meta.Equals(other.meta) | ||
} | ||
|
||
func (r ReadOnly) String() string { | ||
return r.m.String() | ||
return r.meta.String() | ||
} | ||
|
||
func (r ReadOnly) WriteableClone() *Meta { | ||
return r.meta.Clone() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters