s3kv

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package s3kv provide k/v storage by S3 Resty API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(key []byte) error

Delete key/value

func Get

func Get(key []byte) ([]byte, error)

Get value of key

func Has

func Has(key []byte) (bool, error)

Has is used to check the existence of a key

func Put

func Put(key []byte, value []byte) error

Put key/value

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context of s3kv client

func NewContext

func NewContext(name string) *Context

NewContext return a new Context of s3kv

Context was initialized from client that named `s3kv_name` in config file NewContext will return nil if no client found by name `s3kv_name`

func (*Context) Delete

func (c *Context) Delete(key []byte) error

Delete key/value

func (*Context) Get

func (c *Context) Get(key []byte) ([]byte, error)

Get value of key

func (*Context) Has

func (c *Context) Has(key []byte) (bool, error)

Has is used to check the existence of a key

func (*Context) List

func (c *Context) List(params map[string]string) (*ListResult, error)

List keys

func (*Context) Name added in v0.0.2

func (c *Context) Name() string

Name return name of context

func (*Context) Put

func (c *Context) Put(key []byte, value []byte) error

Put key/value

type ListCommonPrefixes

type ListCommonPrefixes struct {
	Prefix []string `xml:"Prefix"`
}

ListCommonPrefixes is container of ListResult

type ListContent

type ListContent struct {
	Key          string           `xml:"Key"`
	ETag         string           `xml:"ETag"`
	Size         string           `xml:"Size"`
	Type         string           `xml:"Type"`
	LastModified string           `xml:"LastModified"`
	StorageClass string           `xml:"StorageClass"`
	Owner        ListContentOwner `xml:"Owner"`
}

ListContent is container of ListResult

type ListContentOwner

type ListContentOwner struct {
	ID          string `xml:"ID"`
	DisplayName string `xml:"DisplayName"`
}

ListContentOwner is container of ListContent

type ListResult

type ListResult struct {
	Name           string             `xml:"Name"`
	Marker         string             `xml:"Marker"`
	Prefix         string             `xml:"Prefix"`
	MaxKeys        string             `xml:"MaxKeys"`
	Delimiter      string             `xml:"Delimiter"`
	NextMarker     string             `xml:"NextMarker"`
	IsTruncated    string             `xml:"IsTruncated"`
	Contents       []ListContent      `xml:"Contents"`
	CommonPrefixes ListCommonPrefixes `xml:"CommonPrefixes"`
}

ListResult indicates xml of s3 list result

func List

func List(params map[string]string) (*ListResult, error)

List keys

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL