2024-11-06 15:17:35 +01:00
|
|
|
package meta
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/ipld/go-ipld-prime"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ReadOnly wraps a Meta into a read-only facade.
|
|
|
|
|
type ReadOnly struct {
|
|
|
|
|
m *Meta
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) GetBool(key string) (bool, error) {
|
|
|
|
|
return r.m.GetBool(key)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) GetString(key string) (string, error) {
|
|
|
|
|
return r.m.GetString(key)
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 15:29:48 +01:00
|
|
|
func (r ReadOnly) GetEncryptedString(key string, encryptionKey []byte) (string, error) {
|
|
|
|
|
return r.m.GetEncryptedString(key, encryptionKey)
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-06 15:17:35 +01:00
|
|
|
func (r ReadOnly) GetInt64(key string) (int64, error) {
|
|
|
|
|
return r.m.GetInt64(key)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) GetFloat64(key string) (float64, error) {
|
|
|
|
|
return r.m.GetFloat64(key)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) GetBytes(key string) ([]byte, error) {
|
|
|
|
|
return r.m.GetBytes(key)
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 15:29:48 +01:00
|
|
|
func (r ReadOnly) GetEncryptedBytes(key string, encryptionKey []byte) ([]byte, error) {
|
|
|
|
|
return r.m.GetEncryptedBytes(key, encryptionKey)
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-06 15:17:35 +01:00
|
|
|
func (r ReadOnly) GetNode(key string) (ipld.Node, error) {
|
|
|
|
|
return r.m.GetNode(key)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) Equals(other ReadOnly) bool {
|
|
|
|
|
return r.m.Equals(other.m)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r ReadOnly) String() string {
|
|
|
|
|
return r.m.String()
|
|
|
|
|
}
|