We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 740521c commit 73743d6Copy full SHA for 73743d6
options/dag.go
@@ -5,6 +5,7 @@ type DagPutSettings struct {
5
InputEnc string
6
Kind string
7
Pin string
8
+ Hash string
9
}
10
11
// DagPutOption is a single DagPut option.
@@ -16,6 +17,7 @@ func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) {
16
17
InputEnc: "json",
18
Kind: "cbor",
19
Pin: "false",
20
+ Hash: "sha2-256",
21
22
23
for _, opt := range opts {
@@ -57,3 +59,11 @@ func (dagOpts) Kind(kind string) DagPutOption {
57
59
return nil
58
60
61
62
+
63
+// Hash is an option for Dag.Put which specifies the hash function to use
64
+func (dagOpts) Hash(hash string) DagPutOption {
65
+ return func(opts *DagPutSettings) error {
66
+ opts.Hash = hash
67
+ return nil
68
+ }
69
+}
0 commit comments