MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Set

Method Set

driver/oss/s3.go:28–50  ·  view source on GitHub ↗

Set stores the given value for the given key. Values are automatically marshalled to JSON or gob (depending on the configuration). The key must not be "" and the value must not be nil.

(k string, v any)

Source from the content-addressed store, hash-verified

26// Values are automatically marshalled to JSON or gob (depending on the configuration).
27// The key must not be "" and the value must not be nil.
28func (c Client) Set(k string, v any) error {
29 if err := util.CheckKeyAndValue(k, v); err != nil {
30 return err
31 }
32
33 // First turn the passed object into something that S3 can handle.
34 data, err := c.codec.Marshal(v)
35 if err != nil {
36 return err
37 }
38
39 pubObjectInput := awss3.PutObjectInput{
40 Body: bytes.NewReader(data),
41 Bucket: &c.bucketName,
42 Key: &k,
43 }
44 _, err = c.c.PutObject(&pubObjectInput)
45 if err != nil {
46 return err
47 }
48
49 return nil
50}
51
52// Get retrieves the stored value for the given key.
53// You need to pass a pointer to the value, so in case of a struct

Callers 15

S3PutMethod · 0.95
getTestConnFunction · 0.80
cmdDECRBYFunction · 0.80
cmdDECRFunction · 0.80
cmdSETFunction · 0.80
TestKVFunction · 0.80
NewConnFunction · 0.80
NewCustomizedConnFunction · 0.80
NewClientConnFunction · 0.80
CloseMethod · 0.80
NewConnFunction · 0.80
NewCustomizedConnFunction · 0.80

Calls

no outgoing calls

Tested by 15

getTestConnFunction · 0.64
TestKVFunction · 0.64
TestSpopFunction · 0.64
TestSrandmemberFunction · 0.64
TestSscanFunction · 0.64
TestSortedSetRangeFunction · 0.64
TestSortedSetRemFunction · 0.64
TestSortedSetScoreFunction · 0.64