id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
148,700
minio/minio-go
api-get-policy.go
getBucketPolicy
func (c Client) getBucketPolicy(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("policy", "") // Execute GET on bucket to list objects. resp, err := c.executeMethod(context.Background(), "GET", r...
go
func (c Client) getBucketPolicy(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("policy", "") // Execute GET on bucket to list objects. resp, err := c.executeMethod(context.Background(), "GET", r...
[ "func", "(", "c", "Client", ")", "getBucketPolicy", "(", "bucketName", "string", ")", "(", "string", ",", "error", ")", "{", "// Get resources properly escaped and lined up before", "// using them in http request.", "urlValues", ":=", "make", "(", "url", ".", "Values"...
// Request server for current bucket policy.
[ "Request", "server", "for", "current", "bucket", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-policy.go#L47-L78
148,701
minio/minio-go
pkg/s3signer/request-signature-streaming.go
getSignedChunkLength
func getSignedChunkLength(chunkDataSize int64) int64 { return int64(len(fmt.Sprintf("%x", chunkDataSize))) + chunkSigConstLen + signatureStrLen + crlfLen + chunkDataSize + crlfLen }
go
func getSignedChunkLength(chunkDataSize int64) int64 { return int64(len(fmt.Sprintf("%x", chunkDataSize))) + chunkSigConstLen + signatureStrLen + crlfLen + chunkDataSize + crlfLen }
[ "func", "getSignedChunkLength", "(", "chunkDataSize", "int64", ")", "int64", "{", "return", "int64", "(", "len", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "chunkDataSize", ")", ")", ")", "+", "chunkSigConstLen", "+", "signatureStrLen", "+", "crlfLen"...
// getSignedChunkLength - calculates the length of chunk metadata
[ "getSignedChunkLength", "-", "calculates", "the", "length", "of", "chunk", "metadata" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L53-L60
148,702
minio/minio-go
pkg/s3signer/request-signature-streaming.go
buildChunkStringToSign
func buildChunkStringToSign(t time.Time, region, previousSig string, chunkData []byte) string { stringToSignParts := []string{ streamingPayloadHdr, t.Format(iso8601DateFormat), getScope(region, t), previousSig, emptySHA256, hex.EncodeToString(sum256(chunkData)), } return strings.Join(stringToSignParts, ...
go
func buildChunkStringToSign(t time.Time, region, previousSig string, chunkData []byte) string { stringToSignParts := []string{ streamingPayloadHdr, t.Format(iso8601DateFormat), getScope(region, t), previousSig, emptySHA256, hex.EncodeToString(sum256(chunkData)), } return strings.Join(stringToSignParts, ...
[ "func", "buildChunkStringToSign", "(", "t", "time", ".", "Time", ",", "region", ",", "previousSig", "string", ",", "chunkData", "[", "]", "byte", ")", "string", "{", "stringToSignParts", ":=", "[", "]", "string", "{", "streamingPayloadHdr", ",", "t", ".", ...
// buildChunkStringToSign - returns the string to sign given chunk data // and previous signature.
[ "buildChunkStringToSign", "-", "returns", "the", "string", "to", "sign", "given", "chunk", "data", "and", "previous", "signature", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L81-L92
148,703
minio/minio-go
pkg/s3signer/request-signature-streaming.go
prepareStreamingRequest
func prepareStreamingRequest(req *http.Request, sessionToken string, dataLen int64, timestamp time.Time) { // Set x-amz-content-sha256 header. req.Header.Set("X-Amz-Content-Sha256", streamingSignAlgorithm) if sessionToken != "" { req.Header.Set("X-Amz-Security-Token", sessionToken) } req.Header.Set("X-Amz-Date"...
go
func prepareStreamingRequest(req *http.Request, sessionToken string, dataLen int64, timestamp time.Time) { // Set x-amz-content-sha256 header. req.Header.Set("X-Amz-Content-Sha256", streamingSignAlgorithm) if sessionToken != "" { req.Header.Set("X-Amz-Security-Token", sessionToken) } req.Header.Set("X-Amz-Date"...
[ "func", "prepareStreamingRequest", "(", "req", "*", "http", ".", "Request", ",", "sessionToken", "string", ",", "dataLen", "int64", ",", "timestamp", "time", ".", "Time", ")", "{", "// Set x-amz-content-sha256 header.", "req", ".", "Header", ".", "Set", "(", "...
// prepareStreamingRequest - prepares a request with appropriate // headers before computing the seed signature.
[ "prepareStreamingRequest", "-", "prepares", "a", "request", "with", "appropriate", "headers", "before", "computing", "the", "seed", "signature", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L96-L107
148,704
minio/minio-go
pkg/s3signer/request-signature-streaming.go
buildChunkSignature
func buildChunkSignature(chunkData []byte, reqTime time.Time, region, previousSignature, secretAccessKey string) string { chunkStringToSign := buildChunkStringToSign(reqTime, region, previousSignature, chunkData) signingKey := getSigningKey(secretAccessKey, region, reqTime) return getSignature(signingKey, chunkS...
go
func buildChunkSignature(chunkData []byte, reqTime time.Time, region, previousSignature, secretAccessKey string) string { chunkStringToSign := buildChunkStringToSign(reqTime, region, previousSignature, chunkData) signingKey := getSigningKey(secretAccessKey, region, reqTime) return getSignature(signingKey, chunkS...
[ "func", "buildChunkSignature", "(", "chunkData", "[", "]", "byte", ",", "reqTime", "time", ".", "Time", ",", "region", ",", "previousSignature", ",", "secretAccessKey", "string", ")", "string", "{", "chunkStringToSign", ":=", "buildChunkStringToSign", "(", "reqTim...
// buildChunkSignature - returns chunk signature for a given chunk and previous signature.
[ "buildChunkSignature", "-", "returns", "chunk", "signature", "for", "a", "given", "chunk", "and", "previous", "signature", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L116-L123
148,705
minio/minio-go
pkg/s3signer/request-signature-streaming.go
setSeedSignature
func (s *StreamingReader) setSeedSignature(req *http.Request) { // Get canonical request canonicalRequest := getCanonicalRequest(*req, ignoredStreamingHeaders) // Get string to sign from canonical request. stringToSign := getStringToSignV4(s.reqTime, s.region, canonicalRequest) signingKey := getSigningKey(s.secr...
go
func (s *StreamingReader) setSeedSignature(req *http.Request) { // Get canonical request canonicalRequest := getCanonicalRequest(*req, ignoredStreamingHeaders) // Get string to sign from canonical request. stringToSign := getStringToSignV4(s.reqTime, s.region, canonicalRequest) signingKey := getSigningKey(s.secr...
[ "func", "(", "s", "*", "StreamingReader", ")", "setSeedSignature", "(", "req", "*", "http", ".", "Request", ")", "{", "// Get canonical request", "canonicalRequest", ":=", "getCanonicalRequest", "(", "*", "req", ",", "ignoredStreamingHeaders", ")", "\n\n", "// Get...
// getSeedSignature - returns the seed signature for a given request.
[ "getSeedSignature", "-", "returns", "the", "seed", "signature", "for", "a", "given", "request", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L126-L137
148,706
minio/minio-go
pkg/s3signer/request-signature-streaming.go
signChunk
func (s *StreamingReader) signChunk(chunkLen int) { // Compute chunk signature for next header signature := buildChunkSignature(s.chunkBuf[:chunkLen], s.reqTime, s.region, s.prevSignature, s.secretAccessKey) // For next chunk signature computation s.prevSignature = signature // Write chunk header into streamin...
go
func (s *StreamingReader) signChunk(chunkLen int) { // Compute chunk signature for next header signature := buildChunkSignature(s.chunkBuf[:chunkLen], s.reqTime, s.region, s.prevSignature, s.secretAccessKey) // For next chunk signature computation s.prevSignature = signature // Write chunk header into streamin...
[ "func", "(", "s", "*", "StreamingReader", ")", "signChunk", "(", "chunkLen", "int", ")", "{", "// Compute chunk signature for next header", "signature", ":=", "buildChunkSignature", "(", "s", ".", "chunkBuf", "[", ":", "chunkLen", "]", ",", "s", ".", "reqTime", ...
// signChunk - signs a chunk read from s.baseReader of chunkLen size.
[ "signChunk", "-", "signs", "a", "chunk", "read", "from", "s", ".", "baseReader", "of", "chunkLen", "size", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L162-L183
148,707
minio/minio-go
pkg/s3signer/request-signature-streaming.go
setStreamingAuthHeader
func (s *StreamingReader) setStreamingAuthHeader(req *http.Request) { credential := GetCredential(s.accessKeyID, s.region, s.reqTime) authParts := []string{ signV4Algorithm + " Credential=" + credential, "SignedHeaders=" + getSignedHeaders(*req, ignoredStreamingHeaders), "Signature=" + s.seedSignature, } // ...
go
func (s *StreamingReader) setStreamingAuthHeader(req *http.Request) { credential := GetCredential(s.accessKeyID, s.region, s.reqTime) authParts := []string{ signV4Algorithm + " Credential=" + credential, "SignedHeaders=" + getSignedHeaders(*req, ignoredStreamingHeaders), "Signature=" + s.seedSignature, } // ...
[ "func", "(", "s", "*", "StreamingReader", ")", "setStreamingAuthHeader", "(", "req", "*", "http", ".", "Request", ")", "{", "credential", ":=", "GetCredential", "(", "s", ".", "accessKeyID", ",", "s", ".", "region", ",", "s", ".", "reqTime", ")", "\n", ...
// setStreamingAuthHeader - builds and sets authorization header value // for streaming signature.
[ "setStreamingAuthHeader", "-", "builds", "and", "sets", "authorization", "header", "value", "for", "streaming", "signature", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L187-L198
148,708
minio/minio-go
pkg/s3signer/request-signature-streaming.go
StreamingSignV4
func StreamingSignV4(req *http.Request, accessKeyID, secretAccessKey, sessionToken, region string, dataLen int64, reqTime time.Time) *http.Request { // Set headers needed for streaming signature. prepareStreamingRequest(req, sessionToken, dataLen, reqTime) if req.Body == nil { req.Body = ioutil.NopCloser(bytes....
go
func StreamingSignV4(req *http.Request, accessKeyID, secretAccessKey, sessionToken, region string, dataLen int64, reqTime time.Time) *http.Request { // Set headers needed for streaming signature. prepareStreamingRequest(req, sessionToken, dataLen, reqTime) if req.Body == nil { req.Body = ioutil.NopCloser(bytes....
[ "func", "StreamingSignV4", "(", "req", "*", "http", ".", "Request", ",", "accessKeyID", ",", "secretAccessKey", ",", "sessionToken", ",", "region", "string", ",", "dataLen", "int64", ",", "reqTime", "time", ".", "Time", ")", "*", "http", ".", "Request", "{...
// StreamingSignV4 - provides chunked upload signatureV4 support by // implementing io.Reader.
[ "StreamingSignV4", "-", "provides", "chunked", "upload", "signatureV4", "support", "by", "implementing", "io", ".", "Reader", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L202-L240
148,709
minio/minio-go
pkg/s3signer/request-signature-streaming.go
Read
func (s *StreamingReader) Read(buf []byte) (int, error) { switch { // After the last chunk is read from underlying reader, we // never re-fill s.buf. case s.done: // s.buf will be (re-)filled with next chunk when has lesser // bytes than asked for. case s.buf.Len() < len(buf): s.chunkBufLen = 0 for { n1,...
go
func (s *StreamingReader) Read(buf []byte) (int, error) { switch { // After the last chunk is read from underlying reader, we // never re-fill s.buf. case s.done: // s.buf will be (re-)filled with next chunk when has lesser // bytes than asked for. case s.buf.Len() < len(buf): s.chunkBufLen = 0 for { n1,...
[ "func", "(", "s", "*", "StreamingReader", ")", "Read", "(", "buf", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "switch", "{", "// After the last chunk is read from underlying reader, we", "// never re-fill s.buf.", "case", "s", ".", "done", ":", ...
// Read - this method performs chunk upload signature providing a // io.Reader interface.
[ "Read", "-", "this", "method", "performs", "chunk", "upload", "signature", "providing", "a", "io", ".", "Reader", "interface", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-streaming.go#L244-L301
148,710
minio/minio-go
api-notification.go
GetBucketNotification
func (c Client) GetBucketNotification(bucketName string) (bucketNotification BucketNotification, err error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return BucketNotification{}, err } notification, err := c.getBucketNotification(bucketName) if err != nil { return ...
go
func (c Client) GetBucketNotification(bucketName string) (bucketNotification BucketNotification, err error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return BucketNotification{}, err } notification, err := c.getBucketNotification(bucketName) if err != nil { return ...
[ "func", "(", "c", "Client", ")", "GetBucketNotification", "(", "bucketName", "string", ")", "(", "bucketNotification", "BucketNotification", ",", "err", "error", ")", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "buc...
// GetBucketNotification - get bucket notification at a given path.
[ "GetBucketNotification", "-", "get", "bucket", "notification", "at", "a", "given", "path", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-notification.go#L33-L43
148,711
minio/minio-go
api-notification.go
getBucketNotification
func (c Client) getBucketNotification(bucketName string) (BucketNotification, error) { urlValues := make(url.Values) urlValues.Set("notification", "") // Execute GET on bucket to list objects. resp, err := c.executeMethod(context.Background(), "GET", requestMetadata{ bucketName: bucketName, queryValues: ...
go
func (c Client) getBucketNotification(bucketName string) (BucketNotification, error) { urlValues := make(url.Values) urlValues.Set("notification", "") // Execute GET on bucket to list objects. resp, err := c.executeMethod(context.Background(), "GET", requestMetadata{ bucketName: bucketName, queryValues: ...
[ "func", "(", "c", "Client", ")", "getBucketNotification", "(", "bucketName", "string", ")", "(", "BucketNotification", ",", "error", ")", "{", "urlValues", ":=", "make", "(", "url", ".", "Values", ")", "\n", "urlValues", ".", "Set", "(", "\"", "\"", ",",...
// Request server for notification rules.
[ "Request", "server", "for", "notification", "rules", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-notification.go#L46-L63
148,712
minio/minio-go
api-notification.go
processBucketNotificationResponse
func processBucketNotificationResponse(bucketName string, resp *http.Response) (BucketNotification, error) { if resp.StatusCode != http.StatusOK { errResponse := httpRespToErrorResponse(resp, bucketName, "") return BucketNotification{}, errResponse } var bucketNotification BucketNotification err := xmlDecoder(r...
go
func processBucketNotificationResponse(bucketName string, resp *http.Response) (BucketNotification, error) { if resp.StatusCode != http.StatusOK { errResponse := httpRespToErrorResponse(resp, bucketName, "") return BucketNotification{}, errResponse } var bucketNotification BucketNotification err := xmlDecoder(r...
[ "func", "processBucketNotificationResponse", "(", "bucketName", "string", ",", "resp", "*", "http", ".", "Response", ")", "(", "BucketNotification", ",", "error", ")", "{", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "errResponse", ":=...
// processes the GetNotification http response from the server.
[ "processes", "the", "GetNotification", "http", "response", "from", "the", "server", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-notification.go#L66-L77
148,713
minio/minio-go
api-notification.go
ListenBucketNotification
func (c Client) ListenBucketNotification(bucketName, prefix, suffix string, events []string, doneCh <-chan struct{}) <-chan NotificationInfo { notificationInfoCh := make(chan NotificationInfo, 1) // Only success, start a routine to start reading line by line. go func(notificationInfoCh chan<- NotificationInfo) { d...
go
func (c Client) ListenBucketNotification(bucketName, prefix, suffix string, events []string, doneCh <-chan struct{}) <-chan NotificationInfo { notificationInfoCh := make(chan NotificationInfo, 1) // Only success, start a routine to start reading line by line. go func(notificationInfoCh chan<- NotificationInfo) { d...
[ "func", "(", "c", "Client", ")", "ListenBucketNotification", "(", "bucketName", ",", "prefix", ",", "suffix", "string", ",", "events", "[", "]", "string", ",", "doneCh", "<-", "chan", "struct", "{", "}", ")", "<-", "chan", "NotificationInfo", "{", "notific...
// ListenBucketNotification - listen on bucket notifications.
[ "ListenBucketNotification", "-", "listen", "on", "bucket", "notifications", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-notification.go#L138-L228
148,714
minio/minio-go
pkg/credentials/signature-type.go
String
func (s SignatureType) String() string { if s.IsV2() { return "S3v2" } else if s.IsV4() { return "S3v4" } else if s.IsStreamingV4() { return "S3v4Streaming" } return "Anonymous" }
go
func (s SignatureType) String() string { if s.IsV2() { return "S3v2" } else if s.IsV4() { return "S3v4" } else if s.IsStreamingV4() { return "S3v4Streaming" } return "Anonymous" }
[ "func", "(", "s", "SignatureType", ")", "String", "(", ")", "string", "{", "if", "s", ".", "IsV2", "(", ")", "{", "return", "\"", "\"", "\n", "}", "else", "if", "s", ".", "IsV4", "(", ")", "{", "return", "\"", "\"", "\n", "}", "else", "if", "...
// Stringer humanized version of signature type, // strings returned here are case insensitive.
[ "Stringer", "humanized", "version", "of", "signature", "type", "strings", "returned", "here", "are", "case", "insensitive", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/credentials/signature-type.go#L57-L66
148,715
minio/minio-go
pkg/s3signer/utils.go
getHostAddr
func getHostAddr(req *http.Request) string { if req.Host != "" { return req.Host } return req.URL.Host }
go
func getHostAddr(req *http.Request) string { if req.Host != "" { return req.Host } return req.URL.Host }
[ "func", "getHostAddr", "(", "req", "*", "http", ".", "Request", ")", "string", "{", "if", "req", ".", "Host", "!=", "\"", "\"", "{", "return", "req", ".", "Host", "\n", "}", "\n", "return", "req", ".", "URL", ".", "Host", "\n", "}" ]
// getHostAddr returns host header if available, otherwise returns host from URL
[ "getHostAddr", "returns", "host", "header", "if", "available", "otherwise", "returns", "host", "from", "URL" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/utils.go#L45-L50
148,716
minio/minio-go
api-error-response.go
Error
func (e ErrorResponse) Error() string { if e.Message == "" { msg, ok := s3ErrorResponseMap[e.Code] if !ok { msg = fmt.Sprintf("Error response code %s.", e.Code) } return msg } return e.Message }
go
func (e ErrorResponse) Error() string { if e.Message == "" { msg, ok := s3ErrorResponseMap[e.Code] if !ok { msg = fmt.Sprintf("Error response code %s.", e.Code) } return msg } return e.Message }
[ "func", "(", "e", "ErrorResponse", ")", "Error", "(", ")", "string", "{", "if", "e", ".", "Message", "==", "\"", "\"", "{", "msg", ",", "ok", ":=", "s3ErrorResponseMap", "[", "e", ".", "Code", "]", "\n", "if", "!", "ok", "{", "msg", "=", "fmt", ...
// Error - Returns S3 error string.
[ "Error", "-", "Returns", "S3", "error", "string", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L81-L90
148,717
minio/minio-go
api-error-response.go
ErrTransferAccelerationBucket
func ErrTransferAccelerationBucket(bucketName string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidArgument", Message: "The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain periods ‘.’.", BucketName: bucketName, } }
go
func ErrTransferAccelerationBucket(bucketName string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidArgument", Message: "The name of the bucket used for Transfer Acceleration must be DNS-compliant and must not contain periods ‘.’.", BucketName: bucketName, } }
[ "func", "ErrTransferAccelerationBucket", "(", "bucketName", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusBadRequest", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "\"", "", "", "BucketName", ":", "...
// ErrTransferAccelerationBucket - bucket name is invalid to be used with transfer acceleration.
[ "ErrTransferAccelerationBucket", "-", "bucket", "name", "is", "invalid", "to", "be", "used", "with", "transfer", "acceleration", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L183-L190
148,718
minio/minio-go
api-error-response.go
ErrEntityTooLarge
func ErrEntityTooLarge(totalSize, maxObjectSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size ‘%d’ exceeds the maximum allowed object size ‘%d’ for single PUT operation.", totalSize, maxObjectSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "...
go
func ErrEntityTooLarge(totalSize, maxObjectSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size ‘%d’ exceeds the maximum allowed object size ‘%d’ for single PUT operation.", totalSize, maxObjectSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "...
[ "func", "ErrEntityTooLarge", "(", "totalSize", ",", "maxObjectSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "S", "i", "e, maxObj", "e", "tSize)", "", "\n", "return", "Error...
// ErrEntityTooLarge - Input size is larger than supported maximum.
[ "ErrEntityTooLarge", "-", "Input", "size", "is", "larger", "than", "supported", "maximum", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L193-L202
148,719
minio/minio-go
api-error-response.go
ErrEntityTooSmall
func ErrEntityTooSmall(totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size ‘%d’ is below the minimum allowed object size ‘0B’ for single PUT operation.", totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "EntityTooSmall", Message: ...
go
func ErrEntityTooSmall(totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Your proposed upload size ‘%d’ is below the minimum allowed object size ‘0B’ for single PUT operation.", totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "EntityTooSmall", Message: ...
[ "func", "ErrEntityTooSmall", "(", "totalSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "S", "i", "e)", "", "\n", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ...
// ErrEntityTooSmall - Input size is smaller than supported minimum.
[ "ErrEntityTooSmall", "-", "Input", "size", "is", "smaller", "than", "supported", "minimum", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L205-L214
148,720
minio/minio-go
api-error-response.go
ErrUnexpectedEOF
func ErrUnexpectedEOF(totalRead, totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Data read ‘%d’ is not equal to the size ‘%d’ of the input Reader.", totalRead, totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "UnexpectedEOF", Message: msg, BucketNa...
go
func ErrUnexpectedEOF(totalRead, totalSize int64, bucketName, objectName string) error { msg := fmt.Sprintf("Data read ‘%d’ is not equal to the size ‘%d’ of the input Reader.", totalRead, totalSize) return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "UnexpectedEOF", Message: msg, BucketNa...
[ "func", "ErrUnexpectedEOF", "(", "totalRead", ",", "totalSize", "int64", ",", "bucketName", ",", "objectName", "string", ")", "error", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "R", "e", "d, totalS", "i", "e)", "", "\n", "return", "ErrorResponse"...
// ErrUnexpectedEOF - Unexpected end of file reached.
[ "ErrUnexpectedEOF", "-", "Unexpected", "end", "of", "file", "reached", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L217-L226
148,721
minio/minio-go
api-error-response.go
ErrInvalidBucketName
func ErrInvalidBucketName(message string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidBucketName", Message: message, RequestID: "minio", } }
go
func ErrInvalidBucketName(message string) error { return ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidBucketName", Message: message, RequestID: "minio", } }
[ "func", "ErrInvalidBucketName", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusBadRequest", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\"", ...
// ErrInvalidBucketName - Invalid bucket name response.
[ "ErrInvalidBucketName", "-", "Invalid", "bucket", "name", "response", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L229-L236
148,722
minio/minio-go
api-error-response.go
ErrInvalidObjectName
func ErrInvalidObjectName(message string) error { return ErrorResponse{ StatusCode: http.StatusNotFound, Code: "NoSuchKey", Message: message, RequestID: "minio", } }
go
func ErrInvalidObjectName(message string) error { return ErrorResponse{ StatusCode: http.StatusNotFound, Code: "NoSuchKey", Message: message, RequestID: "minio", } }
[ "func", "ErrInvalidObjectName", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusNotFound", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\"", ...
// ErrInvalidObjectName - Invalid object name response.
[ "ErrInvalidObjectName", "-", "Invalid", "object", "name", "response", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L239-L246
148,723
minio/minio-go
api-error-response.go
ErrAPINotSupported
func ErrAPINotSupported(message string) error { return ErrorResponse{ StatusCode: http.StatusNotImplemented, Code: "APINotSupported", Message: message, RequestID: "minio", } }
go
func ErrAPINotSupported(message string) error { return ErrorResponse{ StatusCode: http.StatusNotImplemented, Code: "APINotSupported", Message: message, RequestID: "minio", } }
[ "func", "ErrAPINotSupported", "(", "message", "string", ")", "error", "{", "return", "ErrorResponse", "{", "StatusCode", ":", "http", ".", "StatusNotImplemented", ",", "Code", ":", "\"", "\"", ",", "Message", ":", "message", ",", "RequestID", ":", "\"", "\""...
// ErrAPINotSupported - API not supported response // The specified API call is not supported
[ "ErrAPINotSupported", "-", "API", "not", "supported", "response", "The", "specified", "API", "call", "is", "not", "supported" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-error-response.go#L275-L282
148,724
minio/minio-go
pkg/s3signer/request-signature-v2.go
encodeURL2Path
func encodeURL2Path(req *http.Request, virtualHost bool) (path string) { if virtualHost { reqHost := getHostAddr(req) dotPos := strings.Index(reqHost, ".") if dotPos > -1 { bucketName := reqHost[:dotPos] path = "/" + bucketName path += req.URL.Path path = s3utils.EncodePath(path) return } } pa...
go
func encodeURL2Path(req *http.Request, virtualHost bool) (path string) { if virtualHost { reqHost := getHostAddr(req) dotPos := strings.Index(reqHost, ".") if dotPos > -1 { bucketName := reqHost[:dotPos] path = "/" + bucketName path += req.URL.Path path = s3utils.EncodePath(path) return } } pa...
[ "func", "encodeURL2Path", "(", "req", "*", "http", ".", "Request", ",", "virtualHost", "bool", ")", "(", "path", "string", ")", "{", "if", "virtualHost", "{", "reqHost", ":=", "getHostAddr", "(", "req", ")", "\n", "dotPos", ":=", "strings", ".", "Index",...
// Encode input URL path to URL encoded path.
[ "Encode", "input", "URL", "path", "to", "URL", "encoded", "path", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L42-L56
148,725
minio/minio-go
pkg/s3signer/request-signature-v2.go
PostPresignSignatureV2
func PostPresignSignatureV2(policyBase64, secretAccessKey string) string { hm := hmac.New(sha1.New, []byte(secretAccessKey)) hm.Write([]byte(policyBase64)) signature := base64.StdEncoding.EncodeToString(hm.Sum(nil)) return signature }
go
func PostPresignSignatureV2(policyBase64, secretAccessKey string) string { hm := hmac.New(sha1.New, []byte(secretAccessKey)) hm.Write([]byte(policyBase64)) signature := base64.StdEncoding.EncodeToString(hm.Sum(nil)) return signature }
[ "func", "PostPresignSignatureV2", "(", "policyBase64", ",", "secretAccessKey", "string", ")", "string", "{", "hm", ":=", "hmac", ".", "New", "(", "sha1", ".", "New", ",", "[", "]", "byte", "(", "secretAccessKey", ")", ")", "\n", "hm", ".", "Write", "(", ...
// PostPresignSignatureV2 - presigned signature for PostPolicy // request.
[ "PostPresignSignatureV2", "-", "presigned", "signature", "for", "PostPolicy", "request", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L106-L111
148,726
minio/minio-go
pkg/s3signer/request-signature-v2.go
writeSignV2Headers
func writeSignV2Headers(buf *bytes.Buffer, req http.Request) { buf.WriteString(req.Method + "\n") buf.WriteString(req.Header.Get("Content-Md5") + "\n") buf.WriteString(req.Header.Get("Content-Type") + "\n") buf.WriteString(req.Header.Get("Date") + "\n") }
go
func writeSignV2Headers(buf *bytes.Buffer, req http.Request) { buf.WriteString(req.Method + "\n") buf.WriteString(req.Header.Get("Content-Md5") + "\n") buf.WriteString(req.Header.Get("Content-Type") + "\n") buf.WriteString(req.Header.Get("Date") + "\n") }
[ "func", "writeSignV2Headers", "(", "buf", "*", "bytes", ".", "Buffer", ",", "req", "http", ".", "Request", ")", "{", "buf", ".", "WriteString", "(", "req", ".", "Method", "+", "\"", "\\n", "\"", ")", "\n", "buf", ".", "WriteString", "(", "req", ".", ...
// writeSignV2Headers - write signV2 required headers.
[ "writeSignV2Headers", "-", "write", "signV2", "required", "headers", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L209-L214
148,727
minio/minio-go
pkg/s3signer/request-signature-v2.go
writeCanonicalizedHeaders
func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) { var protoHeaders []string vals := make(map[string][]string) for k, vv := range req.Header { // All the AMZ headers should be lowercase lk := strings.ToLower(k) if strings.HasPrefix(lk, "x-amz") { protoHeaders = append(protoHeaders, lk) ...
go
func writeCanonicalizedHeaders(buf *bytes.Buffer, req http.Request) { var protoHeaders []string vals := make(map[string][]string) for k, vv := range req.Header { // All the AMZ headers should be lowercase lk := strings.ToLower(k) if strings.HasPrefix(lk, "x-amz") { protoHeaders = append(protoHeaders, lk) ...
[ "func", "writeCanonicalizedHeaders", "(", "buf", "*", "bytes", ".", "Buffer", ",", "req", "http", ".", "Request", ")", "{", "var", "protoHeaders", "[", "]", "string", "\n", "vals", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", ...
// writeCanonicalizedHeaders - write canonicalized headers.
[ "writeCanonicalizedHeaders", "-", "write", "canonicalized", "headers", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/s3signer/request-signature-v2.go#L217-L249
148,728
minio/minio-go
pkg/credentials/sts_client_grants.go
NewSTSClientGrants
func NewSTSClientGrants(stsEndpoint string, getClientGrantsTokenExpiry func() (*ClientGrantsToken, error)) (*Credentials, error) { if stsEndpoint == "" { return nil, errors.New("STS endpoint cannot be empty") } if getClientGrantsTokenExpiry == nil { return nil, errors.New("Client grants access token and expiry r...
go
func NewSTSClientGrants(stsEndpoint string, getClientGrantsTokenExpiry func() (*ClientGrantsToken, error)) (*Credentials, error) { if stsEndpoint == "" { return nil, errors.New("STS endpoint cannot be empty") } if getClientGrantsTokenExpiry == nil { return nil, errors.New("Client grants access token and expiry r...
[ "func", "NewSTSClientGrants", "(", "stsEndpoint", "string", ",", "getClientGrantsTokenExpiry", "func", "(", ")", "(", "*", "ClientGrantsToken", ",", "error", ")", ")", "(", "*", "Credentials", ",", "error", ")", "{", "if", "stsEndpoint", "==", "\"", "\"", "{...
// NewSTSClientGrants returns a pointer to a new // Credentials object wrapping the STSClientGrants.
[ "NewSTSClientGrants", "returns", "a", "pointer", "to", "a", "new", "Credentials", "object", "wrapping", "the", "STSClientGrants", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/credentials/sts_client_grants.go#L89-L103
148,729
minio/minio-go
api-remove.go
RemoveObject
func (c Client) RemoveObject(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Execute DELETE on objectName. resp, err := c.executeMethod(co...
go
func (c Client) RemoveObject(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Execute DELETE on objectName. resp, err := c.executeMethod(co...
[ "func", "(", "c", "Client", ")", "RemoveObject", "(", "bucketName", ",", "objectName", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil", "{", "retu...
// RemoveObject remove an object from a bucket.
[ "RemoveObject", "remove", "an", "object", "from", "a", "bucket", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L62-L91
148,730
minio/minio-go
api-remove.go
generateRemoveMultiObjectsRequest
func generateRemoveMultiObjectsRequest(objects []string) []byte { rmObjects := []deleteObject{} for _, obj := range objects { rmObjects = append(rmObjects, deleteObject{Key: obj}) } xmlBytes, _ := xml.Marshal(deleteMultiObjects{Objects: rmObjects, Quiet: true}) return xmlBytes }
go
func generateRemoveMultiObjectsRequest(objects []string) []byte { rmObjects := []deleteObject{} for _, obj := range objects { rmObjects = append(rmObjects, deleteObject{Key: obj}) } xmlBytes, _ := xml.Marshal(deleteMultiObjects{Objects: rmObjects, Quiet: true}) return xmlBytes }
[ "func", "generateRemoveMultiObjectsRequest", "(", "objects", "[", "]", "string", ")", "[", "]", "byte", "{", "rmObjects", ":=", "[", "]", "deleteObject", "{", "}", "\n", "for", "_", ",", "obj", ":=", "range", "objects", "{", "rmObjects", "=", "append", "...
// generateRemoveMultiObjects - generate the XML request for remove multi objects request
[ "generateRemoveMultiObjects", "-", "generate", "the", "XML", "request", "for", "remove", "multi", "objects", "request" ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L100-L107
148,731
minio/minio-go
api-remove.go
RemoveObjectsWithContext
func (c Client) RemoveObjectsWithContext(ctx context.Context, bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { errorCh := make(chan RemoveObjectError, 1) // Validate if bucket name is valid. if err := s3utils.CheckValidBucketName(bucketName); err != nil { defer close(errorCh) errorCh <- Re...
go
func (c Client) RemoveObjectsWithContext(ctx context.Context, bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { errorCh := make(chan RemoveObjectError, 1) // Validate if bucket name is valid. if err := s3utils.CheckValidBucketName(bucketName); err != nil { defer close(errorCh) errorCh <- Re...
[ "func", "(", "c", "Client", ")", "RemoveObjectsWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", "string", ",", "objectsCh", "<-", "chan", "string", ")", "<-", "chan", "RemoveObjectError", "{", "errorCh", ":=", "make", "(", "chan", "Rem...
// RemoveObjectsWithContext - Identical to RemoveObjects call, but accepts context to facilitate request cancellation.
[ "RemoveObjectsWithContext", "-", "Identical", "to", "RemoveObjects", "call", "but", "accepts", "context", "to", "facilitate", "request", "cancellation", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L133-L218
148,732
minio/minio-go
api-remove.go
RemoveObjects
func (c Client) RemoveObjects(bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { return c.RemoveObjectsWithContext(context.Background(), bucketName, objectsCh) }
go
func (c Client) RemoveObjects(bucketName string, objectsCh <-chan string) <-chan RemoveObjectError { return c.RemoveObjectsWithContext(context.Background(), bucketName, objectsCh) }
[ "func", "(", "c", "Client", ")", "RemoveObjects", "(", "bucketName", "string", ",", "objectsCh", "<-", "chan", "string", ")", "<-", "chan", "RemoveObjectError", "{", "return", "c", ".", "RemoveObjectsWithContext", "(", "context", ".", "Background", "(", ")", ...
// RemoveObjects removes multiple objects from a bucket. // The list of objects to remove are received from objectsCh. // Remove failures are sent back via error channel.
[ "RemoveObjects", "removes", "multiple", "objects", "from", "a", "bucket", ".", "The", "list", "of", "objects", "to", "remove", "are", "received", "from", "objectsCh", ".", "Remove", "failures", "are", "sent", "back", "via", "error", "channel", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L223-L225
148,733
minio/minio-go
api-remove.go
RemoveIncompleteUpload
func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Find multipart upload ids of the object to be aborte...
go
func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Find multipart upload ids of the object to be aborte...
[ "func", "(", "c", "Client", ")", "RemoveIncompleteUpload", "(", "bucketName", ",", "objectName", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil", "{...
// RemoveIncompleteUpload aborts an partially uploaded object.
[ "RemoveIncompleteUpload", "aborts", "an", "partially", "uploaded", "object", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L228-L251
148,734
minio/minio-go
api-remove.go
abortMultipartUpload
func (c Client) abortMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Initialize url queries...
go
func (c Client) abortMultipartUpload(ctx context.Context, bucketName, objectName, uploadID string) error { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return err } if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } // Initialize url queries...
[ "func", "(", "c", "Client", ")", "abortMultipartUpload", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", ",", "uploadID", "string", ")", "error", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName",...
// abortMultipartUpload aborts a multipart upload for the given // uploadID, all previously uploaded parts are deleted.
[ "abortMultipartUpload", "aborts", "a", "multipart", "upload", "for", "the", "given", "uploadID", "all", "previously", "uploaded", "parts", "are", "deleted", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-remove.go#L255-L303
148,735
minio/minio-go
hook-reader.go
newHook
func newHook(source, hook io.Reader) io.Reader { if hook == nil { return source } return &hookReader{source, hook} }
go
func newHook(source, hook io.Reader) io.Reader { if hook == nil { return source } return &hookReader{source, hook} }
[ "func", "newHook", "(", "source", ",", "hook", "io", ".", "Reader", ")", "io", ".", "Reader", "{", "if", "hook", "==", "nil", "{", "return", "source", "\n", "}", "\n", "return", "&", "hookReader", "{", "source", ",", "hook", "}", "\n", "}" ]
// newHook returns a io.ReadSeeker which implements hookReader that // reports the data read from the source to the hook.
[ "newHook", "returns", "a", "io", ".", "ReadSeeker", "which", "implements", "hookReader", "that", "reports", "the", "data", "read", "from", "the", "source", "to", "the", "hook", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/hook-reader.go#L80-L85
148,736
minio/minio-go
post-policy.go
NewPostPolicy
func NewPostPolicy() *PostPolicy { p := &PostPolicy{} p.conditions = make([]policyCondition, 0) p.formData = make(map[string]string) return p }
go
func NewPostPolicy() *PostPolicy { p := &PostPolicy{} p.conditions = make([]policyCondition, 0) p.formData = make(map[string]string) return p }
[ "func", "NewPostPolicy", "(", ")", "*", "PostPolicy", "{", "p", ":=", "&", "PostPolicy", "{", "}", "\n", "p", ".", "conditions", "=", "make", "(", "[", "]", "policyCondition", ",", "0", ")", "\n", "p", ".", "formData", "=", "make", "(", "map", "[",...
// NewPostPolicy - Instantiate new post policy.
[ "NewPostPolicy", "-", "Instantiate", "new", "post", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L66-L71
148,737
minio/minio-go
post-policy.go
SetExpires
func (p *PostPolicy) SetExpires(t time.Time) error { if t.IsZero() { return ErrInvalidArgument("No expiry time set.") } p.expiration = t return nil }
go
func (p *PostPolicy) SetExpires(t time.Time) error { if t.IsZero() { return ErrInvalidArgument("No expiry time set.") } p.expiration = t return nil }
[ "func", "(", "p", "*", "PostPolicy", ")", "SetExpires", "(", "t", "time", ".", "Time", ")", "error", "{", "if", "t", ".", "IsZero", "(", ")", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ".", "expiration", "=", ...
// SetExpires - Sets expiration time for the new policy.
[ "SetExpires", "-", "Sets", "expiration", "time", "for", "the", "new", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L74-L80
148,738
minio/minio-go
post-policy.go
SetKey
func (p *PostPolicy) SetKey(key string) error { if strings.TrimSpace(key) == "" || key == "" { return ErrInvalidArgument("Object name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$key", value: key, } if err := p.addNewPolicy(policyCond); err != nil { return err } p.form...
go
func (p *PostPolicy) SetKey(key string) error { if strings.TrimSpace(key) == "" || key == "" { return ErrInvalidArgument("Object name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$key", value: key, } if err := p.addNewPolicy(policyCond); err != nil { return err } p.form...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetKey", "(", "key", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "key", ")", "==", "\"", "\"", "||", "key", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ...
// SetKey - Sets an object name for the policy based upload.
[ "SetKey", "-", "Sets", "an", "object", "name", "for", "the", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L83-L97
148,739
minio/minio-go
post-policy.go
SetKeyStartsWith
func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error { if strings.TrimSpace(keyStartsWith) == "" || keyStartsWith == "" { return ErrInvalidArgument("Object prefix is empty.") } policyCond := policyCondition{ matchType: "starts-with", condition: "$key", value: keyStartsWith, } if err := p.a...
go
func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error { if strings.TrimSpace(keyStartsWith) == "" || keyStartsWith == "" { return ErrInvalidArgument("Object prefix is empty.") } policyCond := policyCondition{ matchType: "starts-with", condition: "$key", value: keyStartsWith, } if err := p.a...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetKeyStartsWith", "(", "keyStartsWith", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "keyStartsWith", ")", "==", "\"", "\"", "||", "keyStartsWith", "==", "\"", "\"", "{", "return", "ErrInv...
// SetKeyStartsWith - Sets an object name that an policy based upload // can start with.
[ "SetKeyStartsWith", "-", "Sets", "an", "object", "name", "that", "an", "policy", "based", "upload", "can", "start", "with", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L101-L115
148,740
minio/minio-go
post-policy.go
SetBucket
func (p *PostPolicy) SetBucket(bucketName string) error { if strings.TrimSpace(bucketName) == "" || bucketName == "" { return ErrInvalidArgument("Bucket name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$bucket", value: bucketName, } if err := p.addNewPolicy(policyCond); er...
go
func (p *PostPolicy) SetBucket(bucketName string) error { if strings.TrimSpace(bucketName) == "" || bucketName == "" { return ErrInvalidArgument("Bucket name is empty.") } policyCond := policyCondition{ matchType: "eq", condition: "$bucket", value: bucketName, } if err := p.addNewPolicy(policyCond); er...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetBucket", "(", "bucketName", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "bucketName", ")", "==", "\"", "\"", "||", "bucketName", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", ...
// SetBucket - Sets bucket at which objects will be uploaded to.
[ "SetBucket", "-", "Sets", "bucket", "at", "which", "objects", "will", "be", "uploaded", "to", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L118-L132
148,741
minio/minio-go
post-policy.go
SetContentType
func (p *PostPolicy) SetContentType(contentType string) error { if strings.TrimSpace(contentType) == "" || contentType == "" { return ErrInvalidArgument("No content type specified.") } policyCond := policyCondition{ matchType: "eq", condition: "$Content-Type", value: contentType, } if err := p.addNewPo...
go
func (p *PostPolicy) SetContentType(contentType string) error { if strings.TrimSpace(contentType) == "" || contentType == "" { return ErrInvalidArgument("No content type specified.") } policyCond := policyCondition{ matchType: "eq", condition: "$Content-Type", value: contentType, } if err := p.addNewPo...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetContentType", "(", "contentType", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "contentType", ")", "==", "\"", "\"", "||", "contentType", "==", "\"", "\"", "{", "return", "ErrInvalidArgu...
// SetContentType - Sets content-type of the object for this policy // based upload.
[ "SetContentType", "-", "Sets", "content", "-", "type", "of", "the", "object", "for", "this", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L136-L150
148,742
minio/minio-go
post-policy.go
SetContentLengthRange
func (p *PostPolicy) SetContentLengthRange(min, max int64) error { if min > max { return ErrInvalidArgument("Minimum limit is larger than maximum limit.") } if min < 0 { return ErrInvalidArgument("Minimum limit cannot be negative.") } if max < 0 { return ErrInvalidArgument("Maximum limit cannot be negative."...
go
func (p *PostPolicy) SetContentLengthRange(min, max int64) error { if min > max { return ErrInvalidArgument("Minimum limit is larger than maximum limit.") } if min < 0 { return ErrInvalidArgument("Minimum limit cannot be negative.") } if max < 0 { return ErrInvalidArgument("Maximum limit cannot be negative."...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetContentLengthRange", "(", "min", ",", "max", "int64", ")", "error", "{", "if", "min", ">", "max", "{", "return", "ErrInvalidArgument", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "min", "<", "0", "{", ...
// SetContentLengthRange - Set new min and max content length // condition for all incoming uploads.
[ "SetContentLengthRange", "-", "Set", "new", "min", "and", "max", "content", "length", "condition", "for", "all", "incoming", "uploads", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L154-L167
148,743
minio/minio-go
post-policy.go
SetSuccessStatusAction
func (p *PostPolicy) SetSuccessStatusAction(status string) error { if strings.TrimSpace(status) == "" || status == "" { return ErrInvalidArgument("Status is empty") } policyCond := policyCondition{ matchType: "eq", condition: "$success_action_status", value: status, } if err := p.addNewPolicy(policyCon...
go
func (p *PostPolicy) SetSuccessStatusAction(status string) error { if strings.TrimSpace(status) == "" || status == "" { return ErrInvalidArgument("Status is empty") } policyCond := policyCondition{ matchType: "eq", condition: "$success_action_status", value: status, } if err := p.addNewPolicy(policyCon...
[ "func", "(", "p", "*", "PostPolicy", ")", "SetSuccessStatusAction", "(", "status", "string", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "status", ")", "==", "\"", "\"", "||", "status", "==", "\"", "\"", "{", "return", "ErrInvalidArgument", ...
// SetSuccessStatusAction - Sets the status success code of the object for this policy // based upload.
[ "SetSuccessStatusAction", "-", "Sets", "the", "status", "success", "code", "of", "the", "object", "for", "this", "policy", "based", "upload", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L171-L185
148,744
minio/minio-go
post-policy.go
addNewPolicy
func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error { if policyCond.matchType == "" || policyCond.condition == "" || policyCond.value == "" { return ErrInvalidArgument("Policy fields are empty.") } p.conditions = append(p.conditions, policyCond) return nil }
go
func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error { if policyCond.matchType == "" || policyCond.condition == "" || policyCond.value == "" { return ErrInvalidArgument("Policy fields are empty.") } p.conditions = append(p.conditions, policyCond) return nil }
[ "func", "(", "p", "*", "PostPolicy", ")", "addNewPolicy", "(", "policyCond", "policyCondition", ")", "error", "{", "if", "policyCond", ".", "matchType", "==", "\"", "\"", "||", "policyCond", ".", "condition", "==", "\"", "\"", "||", "policyCond", ".", "val...
// addNewPolicy - internal helper to validate adding new policies.
[ "addNewPolicy", "-", "internal", "helper", "to", "validate", "adding", "new", "policies", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L232-L238
148,745
minio/minio-go
post-policy.go
marshalJSON
func (p PostPolicy) marshalJSON() []byte { expirationStr := `"expiration":"` + p.expiration.Format(expirationDateFormat) + `"` var conditionsStr string conditions := []string{} for _, po := range p.conditions { conditions = append(conditions, fmt.Sprintf("[\"%s\",\"%s\",\"%s\"]", po.matchType, po.condition, po.va...
go
func (p PostPolicy) marshalJSON() []byte { expirationStr := `"expiration":"` + p.expiration.Format(expirationDateFormat) + `"` var conditionsStr string conditions := []string{} for _, po := range p.conditions { conditions = append(conditions, fmt.Sprintf("[\"%s\",\"%s\",\"%s\"]", po.matchType, po.condition, po.va...
[ "func", "(", "p", "PostPolicy", ")", "marshalJSON", "(", ")", "[", "]", "byte", "{", "expirationStr", ":=", "`\"expiration\":\"`", "+", "p", ".", "expiration", ".", "Format", "(", "expirationDateFormat", ")", "+", "`\"`", "\n", "var", "conditionsStr", "strin...
// marshalJSON - Provides Marshalled JSON in bytes.
[ "marshalJSON", "-", "Provides", "Marshalled", "JSON", "in", "bytes", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/post-policy.go#L246-L265
148,746
minio/minio-go
pkg/policy/bucket-policy.go
IsValidBucketPolicy
func (p BucketPolicy) IsValidBucketPolicy() bool { switch p { case BucketPolicyNone, BucketPolicyReadOnly, BucketPolicyReadWrite, BucketPolicyWriteOnly: return true } return false }
go
func (p BucketPolicy) IsValidBucketPolicy() bool { switch p { case BucketPolicyNone, BucketPolicyReadOnly, BucketPolicyReadWrite, BucketPolicyWriteOnly: return true } return false }
[ "func", "(", "p", "BucketPolicy", ")", "IsValidBucketPolicy", "(", ")", "bool", "{", "switch", "p", "{", "case", "BucketPolicyNone", ",", "BucketPolicyReadOnly", ",", "BucketPolicyReadWrite", ",", "BucketPolicyWriteOnly", ":", "return", "true", "\n", "}", "\n", ...
// IsValidBucketPolicy - returns true if policy is valid and supported, false otherwise.
[ "IsValidBucketPolicy", "-", "returns", "true", "if", "policy", "is", "valid", "and", "supported", "false", "otherwise", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L41-L47
148,747
minio/minio-go
pkg/policy/bucket-policy.go
UnmarshalJSON
func (u *User) UnmarshalJSON(data []byte) error { // Try to unmarshal data in a struct equal to User, we need it // to avoid infinite recursive call of this function type AliasUser User var au AliasUser err := json.Unmarshal(data, &au) if err == nil { *u = User(au) return nil } // Data type is not known, ch...
go
func (u *User) UnmarshalJSON(data []byte) error { // Try to unmarshal data in a struct equal to User, we need it // to avoid infinite recursive call of this function type AliasUser User var au AliasUser err := json.Unmarshal(data, &au) if err == nil { *u = User(au) return nil } // Data type is not known, ch...
[ "func", "(", "u", "*", "User", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "// Try to unmarshal data in a struct equal to User, we need it", "// to avoid infinite recursive call of this function", "type", "AliasUser", "User", "\n", "var", "au",...
// UnmarshalJSON is a custom json unmarshaler for Principal field, // the reason is that Principal can take a json struct represented by // User string but it can also take a string.
[ "UnmarshalJSON", "is", "a", "custom", "json", "unmarshaler", "for", "Principal", "field", "the", "reason", "is", "that", "Principal", "can", "take", "a", "json", "struct", "represented", "by", "User", "string", "but", "it", "can", "also", "take", "a", "strin...
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L90-L112
148,748
minio/minio-go
pkg/policy/bucket-policy.go
isValidStatement
func isValidStatement(statement Statement, bucketName string) bool { if statement.Actions.Intersection(validActions).IsEmpty() { return false } if statement.Effect != "Allow" { return false } if statement.Principal.AWS == nil || !statement.Principal.AWS.Contains("*") { return false } bucketResource := a...
go
func isValidStatement(statement Statement, bucketName string) bool { if statement.Actions.Intersection(validActions).IsEmpty() { return false } if statement.Effect != "Allow" { return false } if statement.Principal.AWS == nil || !statement.Principal.AWS.Contains("*") { return false } bucketResource := a...
[ "func", "isValidStatement", "(", "statement", "Statement", ",", "bucketName", "string", ")", "bool", "{", "if", "statement", ".", "Actions", ".", "Intersection", "(", "validActions", ")", ".", "IsEmpty", "(", ")", "{", "return", "false", "\n", "}", "\n\n", ...
// isValidStatement - returns whether given statement is valid to process for given bucket name.
[ "isValidStatement", "-", "returns", "whether", "given", "statement", "is", "valid", "to", "process", "for", "given", "bucket", "name", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L131-L154
148,749
minio/minio-go
pkg/policy/bucket-policy.go
newBucketStatement
func newBucketStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } bucketResource := set.CreateStringSet(awsResourcePrefix + bucketName) statement := Statement{ Actions: ...
go
func newBucketStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } bucketResource := set.CreateStringSet(awsResourcePrefix + bucketName) statement := Statement{ Actions: ...
[ "func", "newBucketStatement", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "if", "policy", "==", "Buc...
// Returns new statements with bucket actions for given policy.
[ "Returns", "new", "statements", "with", "bucket", "actions", "for", "given", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L157-L204
148,750
minio/minio-go
pkg/policy/bucket-policy.go
newObjectStatement
func newObjectStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } statement := Statement{ Effect: "Allow", Principal: User{AWS: set.CreateStringSet("*")}, Resources:...
go
func newObjectStatement(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} if policy == BucketPolicyNone || bucketName == "" { return statements } statement := Statement{ Effect: "Allow", Principal: User{AWS: set.CreateStringSet("*")}, Resources:...
[ "func", "newObjectStatement", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "if", "policy", "==", "Buc...
// Returns new statements contains object actions for given policy.
[ "Returns", "new", "statements", "contains", "object", "actions", "for", "given", "policy", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L207-L230
148,751
minio/minio-go
pkg/policy/bucket-policy.go
newStatements
func newStatements(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} ns := newBucketStatement(policy, bucketName, prefix) statements = append(statements, ns...) ns = newObjectStatement(policy, bucketName, prefix) statements = append(statements, ns...) r...
go
func newStatements(policy BucketPolicy, bucketName string, prefix string) (statements []Statement) { statements = []Statement{} ns := newBucketStatement(policy, bucketName, prefix) statements = append(statements, ns...) ns = newObjectStatement(policy, bucketName, prefix) statements = append(statements, ns...) r...
[ "func", "newStatements", "(", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "statements", "[", "]", "Statement", ")", "{", "statements", "=", "[", "]", "Statement", "{", "}", "\n", "ns", ":=", "newBucketStatement",...
// Returns new statements for given policy, bucket and prefix.
[ "Returns", "new", "statements", "for", "given", "policy", "bucket", "and", "prefix", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L233-L242
148,752
minio/minio-go
pkg/policy/bucket-policy.go
getInUsePolicy
func getInUsePolicy(statements []Statement, bucketName string, prefix string) (readOnlyInUse, writeOnlyInUse bool) { resourcePrefix := awsResourcePrefix + bucketName + "/" objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" for _, s := range statements { if !s.Resources.Contains(objectResource) ...
go
func getInUsePolicy(statements []Statement, bucketName string, prefix string) (readOnlyInUse, writeOnlyInUse bool) { resourcePrefix := awsResourcePrefix + bucketName + "/" objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" for _, s := range statements { if !s.Resources.Contains(objectResource) ...
[ "func", "getInUsePolicy", "(", "statements", "[", "]", "Statement", ",", "bucketName", "string", ",", "prefix", "string", ")", "(", "readOnlyInUse", ",", "writeOnlyInUse", "bool", ")", "{", "resourcePrefix", ":=", "awsResourcePrefix", "+", "bucketName", "+", "\"...
// Returns whether given bucket statements are used by other than given prefix statements.
[ "Returns", "whether", "given", "bucket", "statements", "are", "used", "by", "other", "than", "given", "prefix", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L245-L265
148,753
minio/minio-go
pkg/policy/bucket-policy.go
removeObjectActions
func removeObjectActions(statement Statement, objectResource string) Statement { if statement.Conditions == nil { if len(statement.Resources) > 1 { statement.Resources.Remove(objectResource) } else { statement.Actions = statement.Actions.Difference(readOnlyObjectActions) statement.Actions = statement.Acti...
go
func removeObjectActions(statement Statement, objectResource string) Statement { if statement.Conditions == nil { if len(statement.Resources) > 1 { statement.Resources.Remove(objectResource) } else { statement.Actions = statement.Actions.Difference(readOnlyObjectActions) statement.Actions = statement.Acti...
[ "func", "removeObjectActions", "(", "statement", "Statement", ",", "objectResource", "string", ")", "Statement", "{", "if", "statement", ".", "Conditions", "==", "nil", "{", "if", "len", "(", "statement", ".", "Resources", ")", ">", "1", "{", "statement", "....
// Removes object actions in given statement.
[ "Removes", "object", "actions", "in", "given", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L268-L279
148,754
minio/minio-go
pkg/policy/bucket-policy.go
removeBucketActions
func removeBucketActions(statement Statement, prefix string, bucketResource string, readOnlyInUse, writeOnlyInUse bool) Statement { removeReadOnly := func() { if !statement.Actions.Intersection(readOnlyBucketActions).Equals(readOnlyBucketActions) { return } if statement.Conditions == nil { statement.Actio...
go
func removeBucketActions(statement Statement, prefix string, bucketResource string, readOnlyInUse, writeOnlyInUse bool) Statement { removeReadOnly := func() { if !statement.Actions.Intersection(readOnlyBucketActions).Equals(readOnlyBucketActions) { return } if statement.Conditions == nil { statement.Actio...
[ "func", "removeBucketActions", "(", "statement", "Statement", ",", "prefix", "string", ",", "bucketResource", "string", ",", "readOnlyInUse", ",", "writeOnlyInUse", "bool", ")", "Statement", "{", "removeReadOnly", ":=", "func", "(", ")", "{", "if", "!", "stateme...
// Removes bucket actions for given policy in given statement.
[ "Removes", "bucket", "actions", "for", "given", "policy", "in", "given", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L282-L340
148,755
minio/minio-go
pkg/policy/bucket-policy.go
appendStatement
func appendStatement(statements []Statement, statement Statement) []Statement { for i, s := range statements { if s.Actions.Equals(statement.Actions) && s.Effect == statement.Effect && s.Principal.AWS.Equals(statement.Principal.AWS) && reflect.DeepEqual(s.Conditions, statement.Conditions) { statements[i]...
go
func appendStatement(statements []Statement, statement Statement) []Statement { for i, s := range statements { if s.Actions.Equals(statement.Actions) && s.Effect == statement.Effect && s.Principal.AWS.Equals(statement.Principal.AWS) && reflect.DeepEqual(s.Conditions, statement.Conditions) { statements[i]...
[ "func", "appendStatement", "(", "statements", "[", "]", "Statement", ",", "statement", "Statement", ")", "[", "]", "Statement", "{", "for", "i", ",", "s", ":=", "range", "statements", "{", "if", "s", ".", "Actions", ".", "Equals", "(", "statement", ".", ...
// Appends given statement into statement list to have unique statements. // - If statement already exists in statement list, it ignores. // - If statement exists with different conditions, they are merged. // - Else the statement is appended to statement list.
[ "Appends", "given", "statement", "into", "statement", "list", "to", "have", "unique", "statements", ".", "-", "If", "statement", "already", "exists", "in", "statement", "list", "it", "ignores", ".", "-", "If", "statement", "exists", "with", "different", "condi...
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L436-L473
148,756
minio/minio-go
pkg/policy/bucket-policy.go
appendStatements
func appendStatements(statements []Statement, appendStatements []Statement) []Statement { for _, s := range appendStatements { statements = appendStatement(statements, s) } return statements }
go
func appendStatements(statements []Statement, appendStatements []Statement) []Statement { for _, s := range appendStatements { statements = appendStatement(statements, s) } return statements }
[ "func", "appendStatements", "(", "statements", "[", "]", "Statement", ",", "appendStatements", "[", "]", "Statement", ")", "[", "]", "Statement", "{", "for", "_", ",", "s", ":=", "range", "appendStatements", "{", "statements", "=", "appendStatement", "(", "s...
// Appends two statement lists.
[ "Appends", "two", "statement", "lists", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L476-L482
148,757
minio/minio-go
pkg/policy/bucket-policy.go
getBucketPolicy
func getBucketPolicy(statement Statement, prefix string) (commonFound, readOnly, writeOnly bool) { if !(statement.Effect == "Allow" && statement.Principal.AWS.Contains("*")) { return commonFound, readOnly, writeOnly } if statement.Actions.Intersection(commonBucketActions).Equals(commonBucketActions) && statemen...
go
func getBucketPolicy(statement Statement, prefix string) (commonFound, readOnly, writeOnly bool) { if !(statement.Effect == "Allow" && statement.Principal.AWS.Contains("*")) { return commonFound, readOnly, writeOnly } if statement.Actions.Intersection(commonBucketActions).Equals(commonBucketActions) && statemen...
[ "func", "getBucketPolicy", "(", "statement", "Statement", ",", "prefix", "string", ")", "(", "commonFound", ",", "readOnly", ",", "writeOnly", "bool", ")", "{", "if", "!", "(", "statement", ".", "Effect", "==", "\"", "\"", "&&", "statement", ".", "Principa...
// Returns policy of given bucket statement.
[ "Returns", "policy", "of", "given", "bucket", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L485-L523
148,758
minio/minio-go
pkg/policy/bucket-policy.go
getObjectPolicy
func getObjectPolicy(statement Statement) (readOnly bool, writeOnly bool) { if statement.Effect == "Allow" && statement.Principal.AWS.Contains("*") && statement.Conditions == nil { if statement.Actions.Intersection(readOnlyObjectActions).Equals(readOnlyObjectActions) { readOnly = true } if statement.Actio...
go
func getObjectPolicy(statement Statement) (readOnly bool, writeOnly bool) { if statement.Effect == "Allow" && statement.Principal.AWS.Contains("*") && statement.Conditions == nil { if statement.Actions.Intersection(readOnlyObjectActions).Equals(readOnlyObjectActions) { readOnly = true } if statement.Actio...
[ "func", "getObjectPolicy", "(", "statement", "Statement", ")", "(", "readOnly", "bool", ",", "writeOnly", "bool", ")", "{", "if", "statement", ".", "Effect", "==", "\"", "\"", "&&", "statement", ".", "Principal", ".", "AWS", ".", "Contains", "(", "\"", "...
// Returns policy of given object statement.
[ "Returns", "policy", "of", "given", "object", "statement", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L526-L539
148,759
minio/minio-go
pkg/policy/bucket-policy.go
GetPolicy
func GetPolicy(statements []Statement, bucketName string, prefix string) BucketPolicy { bucketResource := awsResourcePrefix + bucketName objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" bucketCommonFound := false bucketReadOnly := false bucketWriteOnly := false matchedResource := "" objRead...
go
func GetPolicy(statements []Statement, bucketName string, prefix string) BucketPolicy { bucketResource := awsResourcePrefix + bucketName objectResource := awsResourcePrefix + bucketName + "/" + prefix + "*" bucketCommonFound := false bucketReadOnly := false bucketWriteOnly := false matchedResource := "" objRead...
[ "func", "GetPolicy", "(", "statements", "[", "]", "Statement", ",", "bucketName", "string", ",", "prefix", "string", ")", "BucketPolicy", "{", "bucketResource", ":=", "awsResourcePrefix", "+", "bucketName", "\n", "objectResource", ":=", "awsResourcePrefix", "+", "...
// GetPolicy - Returns policy of given bucket name, prefix in given statements.
[ "GetPolicy", "-", "Returns", "policy", "of", "given", "bucket", "name", "prefix", "in", "given", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L542-L594
148,760
minio/minio-go
pkg/policy/bucket-policy.go
GetPolicies
func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy { policyRules := map[string]BucketPolicy{} objResources := set.NewStringSet() // Search all resources related to objects policy for _, s := range statements { for r := range s.Resources { if strings.HasPrefix(r, awsReso...
go
func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy { policyRules := map[string]BucketPolicy{} objResources := set.NewStringSet() // Search all resources related to objects policy for _, s := range statements { for r := range s.Resources { if strings.HasPrefix(r, awsReso...
[ "func", "GetPolicies", "(", "statements", "[", "]", "Statement", ",", "bucketName", ",", "prefix", "string", ")", "map", "[", "string", "]", "BucketPolicy", "{", "policyRules", ":=", "map", "[", "string", "]", "BucketPolicy", "{", "}", "\n", "objResources", ...
// GetPolicies - returns a map of policies of given bucket name, prefix in given statements.
[ "GetPolicies", "-", "returns", "a", "map", "of", "policies", "of", "given", "bucket", "name", "prefix", "in", "given", "statements", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L597-L625
148,761
minio/minio-go
pkg/policy/bucket-policy.go
SetPolicy
func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement { out := removeStatements(statements, bucketName, prefix) // fmt.Println("out = ") // printstatement(out) ns := newStatements(policy, bucketName, prefix) // fmt.Println("ns = ") // printstatement(ns) rv := ...
go
func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement { out := removeStatements(statements, bucketName, prefix) // fmt.Println("out = ") // printstatement(out) ns := newStatements(policy, bucketName, prefix) // fmt.Println("ns = ") // printstatement(ns) rv := ...
[ "func", "SetPolicy", "(", "statements", "[", "]", "Statement", ",", "policy", "BucketPolicy", ",", "bucketName", "string", ",", "prefix", "string", ")", "[", "]", "Statement", "{", "out", ":=", "removeStatements", "(", "statements", ",", "bucketName", ",", "...
// SetPolicy - Returns new statements containing policy of given bucket name and prefix are appended.
[ "SetPolicy", "-", "Returns", "new", "statements", "containing", "policy", "of", "given", "bucket", "name", "and", "prefix", "are", "appended", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L628-L641
148,762
minio/minio-go
pkg/policy/bucket-policy.go
resourceMatch
func resourceMatch(pattern, resource string) bool { if pattern == "" { return resource == pattern } if pattern == "*" { return true } parts := strings.Split(pattern, "*") if len(parts) == 1 { return resource == pattern } tGlob := strings.HasSuffix(pattern, "*") end := len(parts) - 1 if !strings.HasPrefi...
go
func resourceMatch(pattern, resource string) bool { if pattern == "" { return resource == pattern } if pattern == "*" { return true } parts := strings.Split(pattern, "*") if len(parts) == 1 { return resource == pattern } tGlob := strings.HasSuffix(pattern, "*") end := len(parts) - 1 if !strings.HasPrefi...
[ "func", "resourceMatch", "(", "pattern", ",", "resource", "string", ")", "bool", "{", "if", "pattern", "==", "\"", "\"", "{", "return", "resource", "==", "pattern", "\n", "}", "\n", "if", "pattern", "==", "\"", "\"", "{", "return", "true", "\n", "}", ...
// Match function matches wild cards in 'pattern' for resource.
[ "Match", "function", "matches", "wild", "cards", "in", "pattern", "for", "resource", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/pkg/policy/bucket-policy.go#L644-L668
148,763
minio/minio-go
api-put-object-context.go
PutObjectWithContext
func (c Client) PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) (n int64, err error) { err = opts.validate() if err != nil { return 0, err } return c.putObjectCommon(ctx, bucketName, objectName, reader, objectSize, opts) }
go
func (c Client) PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) (n int64, err error) { err = opts.validate() if err != nil { return 0, err } return c.putObjectCommon(ctx, bucketName, objectName, reader, objectSize, opts) }
[ "func", "(", "c", "Client", ")", "PutObjectWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", "string", ",", "reader", "io", ".", "Reader", ",", "objectSize", "int64", ",", "opts", "PutObjectOptions", ")", "(", "n", ...
// PutObjectWithContext - Identical to PutObject call, but accepts context to facilitate request cancellation.
[ "PutObjectWithContext", "-", "Identical", "to", "PutObject", "call", "but", "accepts", "context", "to", "facilitate", "request", "cancellation", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-put-object-context.go#L26-L33
148,764
minio/minio-go
api-get-object-context.go
GetObjectWithContext
func (c Client) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) { return c.getObjectWithContext(ctx, bucketName, objectName, opts) }
go
func (c Client) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error) { return c.getObjectWithContext(ctx, bucketName, objectName, opts) }
[ "func", "(", "c", "Client", ")", "GetObjectWithContext", "(", "ctx", "context", ".", "Context", ",", "bucketName", ",", "objectName", "string", ",", "opts", "GetObjectOptions", ")", "(", "*", "Object", ",", "error", ")", "{", "return", "c", ".", "getObject...
// GetObjectWithContext - returns an seekable, readable object. // The options can be used to specify the GET request further.
[ "GetObjectWithContext", "-", "returns", "an", "seekable", "readable", "object", ".", "The", "options", "can", "be", "used", "to", "specify", "the", "GET", "request", "further", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-object-context.go#L24-L26
148,765
minio/minio-go
api-get-lifecycle.go
GetBucketLifecycle
func (c Client) GetBucketLifecycle(bucketName string) (string, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return "", err } bucketLifecycle, err := c.getBucketLifecycle(bucketName) if err != nil { errResponse := ToErrorResponse(err) if errResponse.Code == "N...
go
func (c Client) GetBucketLifecycle(bucketName string) (string, error) { // Input validation. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return "", err } bucketLifecycle, err := c.getBucketLifecycle(bucketName) if err != nil { errResponse := ToErrorResponse(err) if errResponse.Code == "N...
[ "func", "(", "c", "Client", ")", "GetBucketLifecycle", "(", "bucketName", "string", ")", "(", "string", ",", "error", ")", "{", "// Input validation.", "if", "err", ":=", "s3utils", ".", "CheckValidBucketName", "(", "bucketName", ")", ";", "err", "!=", "nil"...
// GetBucketLifecycle - get bucket lifecycle.
[ "GetBucketLifecycle", "-", "get", "bucket", "lifecycle", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-lifecycle.go#L30-L44
148,766
minio/minio-go
api-get-lifecycle.go
getBucketLifecycle
func (c Client) getBucketLifecycle(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("lifecycle", "") // Execute GET on bucket to get lifecycle. resp, err := c.executeMethod(context.Background(), "...
go
func (c Client) getBucketLifecycle(bucketName string) (string, error) { // Get resources properly escaped and lined up before // using them in http request. urlValues := make(url.Values) urlValues.Set("lifecycle", "") // Execute GET on bucket to get lifecycle. resp, err := c.executeMethod(context.Background(), "...
[ "func", "(", "c", "Client", ")", "getBucketLifecycle", "(", "bucketName", "string", ")", "(", "string", ",", "error", ")", "{", "// Get resources properly escaped and lined up before", "// using them in http request.", "urlValues", ":=", "make", "(", "url", ".", "Valu...
// Request server for current bucket lifecycle.
[ "Request", "server", "for", "current", "bucket", "lifecycle", "." ]
68eef499b4c530409962a5d1a12fa8c848587761
https://github.com/minio/minio-go/blob/68eef499b4c530409962a5d1a12fa8c848587761/api-get-lifecycle.go#L47-L77
148,767
vsergeev/btckeygenie
btckey/btckey.go
derive
func (priv *PrivateKey) derive() (pub *PublicKey) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* Derive public key from Q = d*G */ Q := secp256k1.ScalarBaseMult(priv.D) /* Check that Q is on the curve */ if !secp256k1.IsOnCurve(Q) { panic("Catastrophic math logic failure in public key derivation.") } priv.X = ...
go
func (priv *PrivateKey) derive() (pub *PublicKey) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* Derive public key from Q = d*G */ Q := secp256k1.ScalarBaseMult(priv.D) /* Check that Q is on the curve */ if !secp256k1.IsOnCurve(Q) { panic("Catastrophic math logic failure in public key derivation.") } priv.X = ...
[ "func", "(", "priv", "*", "PrivateKey", ")", "derive", "(", ")", "(", "pub", "*", "PublicKey", ")", "{", "/* See Certicom's SEC1 3.2.1, pg.23 */", "/* Derive public key from Q = d*G */", "Q", ":=", "secp256k1", ".", "ScalarBaseMult", "(", "priv", ".", "D", ")", ...
// derive derives a Bitcoin public key from a Bitcoin private key.
[ "derive", "derives", "a", "Bitcoin", "public", "key", "from", "a", "Bitcoin", "private", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L54-L69
148,768
vsergeev/btckeygenie
btckey/btckey.go
GenerateKey
func GenerateKey(rand io.Reader) (priv PrivateKey, err error) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */ /* Select private key d randomly from [1, n) */ /* Read N bit length random bytes + 64 extra bits */ b := make([]byte, secp256k1.N...
go
func GenerateKey(rand io.Reader) (priv PrivateKey, err error) { /* See Certicom's SEC1 3.2.1, pg.23 */ /* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */ /* Select private key d randomly from [1, n) */ /* Read N bit length random bytes + 64 extra bits */ b := make([]byte, secp256k1.N...
[ "func", "GenerateKey", "(", "rand", "io", ".", "Reader", ")", "(", "priv", "PrivateKey", ",", "err", "error", ")", "{", "/* See Certicom's SEC1 3.2.1, pg.23 */", "/* See NSA's Suite B Implementer’s Guide to FIPS 186-3 (ECDSA) A.1.1, pg.18 */", "/* Select private key d randomly fr...
// GenerateKey generates a public and private key pair using random source rand.
[ "GenerateKey", "generates", "a", "public", "and", "private", "key", "pair", "using", "random", "source", "rand", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L72-L98
148,769
vsergeev/btckeygenie
btckey/btckey.go
b58decode
func b58decode(s string) (b []byte, err error) { /* See https://en.bitcoin.it/wiki/Base58Check_encoding */ const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" /* Initialize */ x := big.NewInt(0) m := big.NewInt(58) /* Convert string to big int */ for i := 0; i < len(s); i...
go
func b58decode(s string) (b []byte, err error) { /* See https://en.bitcoin.it/wiki/Base58Check_encoding */ const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" /* Initialize */ x := big.NewInt(0) m := big.NewInt(58) /* Convert string to big int */ for i := 0; i < len(s); i...
[ "func", "b58decode", "(", "s", "string", ")", "(", "b", "[", "]", "byte", ",", "err", "error", ")", "{", "/* See https://en.bitcoin.it/wiki/Base58Check_encoding */", "const", "BITCOIN_BASE58_TABLE", "=", "\"", "\"", "\n\n", "/* Initialize */", "x", ":=", "big", ...
// b58decode decodes a base-58 encoded string into a byte slice b.
[ "b58decode", "decodes", "a", "base", "-", "58", "encoded", "string", "into", "a", "byte", "slice", "b", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L131-L155
148,770
vsergeev/btckeygenie
btckey/btckey.go
b58checkdecode
func b58checkdecode(s string) (ver uint8, b []byte, err error) { /* Decode base58 string */ b, err = b58decode(s) if err != nil { return 0, nil, err } /* Add leading zero bytes */ for i := 0; i < len(s); i++ { if s[i] != '1' { break } b = append([]byte{0x00}, b...) } /* Verify checksum */ if len(b...
go
func b58checkdecode(s string) (ver uint8, b []byte, err error) { /* Decode base58 string */ b, err = b58decode(s) if err != nil { return 0, nil, err } /* Add leading zero bytes */ for i := 0; i < len(s); i++ { if s[i] != '1' { break } b = append([]byte{0x00}, b...) } /* Verify checksum */ if len(b...
[ "func", "b58checkdecode", "(", "s", "string", ")", "(", "ver", "uint8", ",", "b", "[", "]", "byte", ",", "err", "error", ")", "{", "/* Decode base58 string */", "b", ",", "err", "=", "b58decode", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", ...
// b58checkdecode decodes base-58 check encoded string s into a version ver and byte slice b.
[ "b58checkdecode", "decodes", "base", "-", "58", "check", "encoded", "string", "s", "into", "a", "version", "ver", "and", "byte", "slice", "b", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L197-L243
148,771
vsergeev/btckeygenie
btckey/btckey.go
ToBytes
func (priv *PrivateKey) ToBytes() (b []byte) { d := priv.D.Bytes() /* Pad D to 32 bytes */ padded_d := append(bytes.Repeat([]byte{0x00}, 32-len(d)), d...) return padded_d }
go
func (priv *PrivateKey) ToBytes() (b []byte) { d := priv.D.Bytes() /* Pad D to 32 bytes */ padded_d := append(bytes.Repeat([]byte{0x00}, 32-len(d)), d...) return padded_d }
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToBytes", "(", ")", "(", "b", "[", "]", "byte", ")", "{", "d", ":=", "priv", ".", "D", ".", "Bytes", "(", ")", "\n\n", "/* Pad D to 32 bytes */", "padded_d", ":=", "append", "(", "bytes", ".", "Repeat", ...
// ToBytes converts a Bitcoin private key to a 32-byte byte slice.
[ "ToBytes", "converts", "a", "Bitcoin", "private", "key", "to", "a", "32", "-", "byte", "byte", "slice", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L278-L285
148,772
vsergeev/btckeygenie
btckey/btckey.go
FromBytes
func (priv *PrivateKey) FromBytes(b []byte) (err error) { if len(b) != 32 { return fmt.Errorf("Invalid private key bytes length %d, expected 32.", len(b)) } priv.D = new(big.Int).SetBytes(b) /* Derive public key from private key */ priv.derive() return nil }
go
func (priv *PrivateKey) FromBytes(b []byte) (err error) { if len(b) != 32 { return fmt.Errorf("Invalid private key bytes length %d, expected 32.", len(b)) } priv.D = new(big.Int).SetBytes(b) /* Derive public key from private key */ priv.derive() return nil }
[ "func", "(", "priv", "*", "PrivateKey", ")", "FromBytes", "(", "b", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "if", "len", "(", "b", ")", "!=", "32", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "b", ")",...
// FromBytes converts a 32-byte byte slice to a Bitcoin private key and derives the corresponding Bitcoin public key.
[ "FromBytes", "converts", "a", "32", "-", "byte", "byte", "slice", "to", "a", "Bitcoin", "private", "key", "and", "derives", "the", "corresponding", "Bitcoin", "public", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L288-L299
148,773
vsergeev/btckeygenie
btckey/btckey.go
ToWIF
func (priv *PrivateKey) ToWIF() (wif string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Convert bytes to base-58 check encoded string with version 0x80 */ wif = b58checkencode(0x80, priv_bytes) return wif }
go
func (priv *PrivateKey) ToWIF() (wif string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Convert bytes to base-58 check encoded string with version 0x80 */ wif = b58checkencode(0x80, priv_bytes) return wif }
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToWIF", "(", ")", "(", "wif", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Convert the private key to bytes */", "priv_bytes", ":=", "priv", ".", "ToBytes", "(", ")", "\n\n", "/* Con...
// ToWIF converts a Bitcoin private key to a Wallet Import Format string.
[ "ToWIF", "converts", "a", "Bitcoin", "private", "key", "to", "a", "Wallet", "Import", "Format", "string", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L302-L312
148,774
vsergeev/btckeygenie
btckey/btckey.go
ToWIFC
func (priv *PrivateKey) ToWIFC() (wifc string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Append 0x01 to tell Bitcoin wallet to use compressed public keys */ priv_bytes = append(priv_bytes, []byte{0x01}...) /* Convert bytes...
go
func (priv *PrivateKey) ToWIFC() (wifc string) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Convert the private key to bytes */ priv_bytes := priv.ToBytes() /* Append 0x01 to tell Bitcoin wallet to use compressed public keys */ priv_bytes = append(priv_bytes, []byte{0x01}...) /* Convert bytes...
[ "func", "(", "priv", "*", "PrivateKey", ")", "ToWIFC", "(", ")", "(", "wifc", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Convert the private key to bytes */", "priv_bytes", ":=", "priv", ".", "ToBytes", "(", ")", "\n\n", "/* A...
// ToWIFC converts a Bitcoin private key to a Wallet Import Format string with the public key compressed flag.
[ "ToWIFC", "converts", "a", "Bitcoin", "private", "key", "to", "a", "Wallet", "Import", "Format", "string", "with", "the", "public", "key", "compressed", "flag", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L315-L328
148,775
vsergeev/btckeygenie
btckey/btckey.go
FromWIF
func (priv *PrivateKey) FromWIF(wif string) (err error) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Base58 Check Decode the WIF string */ ver, priv_bytes, err := b58checkdecode(wif) if err != nil { return err } /* Check that the version byte is 0x80 */ if ver != 0x80 { return fmt.Errorf(...
go
func (priv *PrivateKey) FromWIF(wif string) (err error) { /* See https://en.bitcoin.it/wiki/Wallet_import_format */ /* Base58 Check Decode the WIF string */ ver, priv_bytes, err := b58checkdecode(wif) if err != nil { return err } /* Check that the version byte is 0x80 */ if ver != 0x80 { return fmt.Errorf(...
[ "func", "(", "priv", "*", "PrivateKey", ")", "FromWIF", "(", "wif", "string", ")", "(", "err", "error", ")", "{", "/* See https://en.bitcoin.it/wiki/Wallet_import_format */", "/* Base58 Check Decode the WIF string */", "ver", ",", "priv_bytes", ",", "err", ":=", "b58c...
// FromWIF converts a Wallet Import Format string to a Bitcoin private key and derives the corresponding Bitcoin public key.
[ "FromWIF", "converts", "a", "Wallet", "Import", "Format", "string", "to", "a", "Bitcoin", "private", "key", "and", "derives", "the", "corresponding", "Bitcoin", "public", "key", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L331-L363
148,776
vsergeev/btckeygenie
btckey/btckey.go
ToBytesUncompressed
func (pub *PublicKey) ToBytesUncompressed() (b []byte) { /* See Certicom SEC1 2.3.3, pg. 10 */ x := pub.X.Bytes() y := pub.Y.Bytes() /* Pad X and Y coordinate bytes to 32-bytes */ padded_x := append(bytes.Repeat([]byte{0x00}, 32-len(x)), x...) padded_y := append(bytes.Repeat([]byte{0x00}, 32-len(y)), y...) /*...
go
func (pub *PublicKey) ToBytesUncompressed() (b []byte) { /* See Certicom SEC1 2.3.3, pg. 10 */ x := pub.X.Bytes() y := pub.Y.Bytes() /* Pad X and Y coordinate bytes to 32-bytes */ padded_x := append(bytes.Repeat([]byte{0x00}, 32-len(x)), x...) padded_y := append(bytes.Repeat([]byte{0x00}, 32-len(y)), y...) /*...
[ "func", "(", "pub", "*", "PublicKey", ")", "ToBytesUncompressed", "(", ")", "(", "b", "[", "]", "byte", ")", "{", "/* See Certicom SEC1 2.3.3, pg. 10 */", "x", ":=", "pub", ".", "X", ".", "Bytes", "(", ")", "\n", "y", ":=", "pub", ".", "Y", ".", "Byt...
// ToBytesUncompressed converts a Bitcoin public key to a 65-byte byte slice without point compression.
[ "ToBytesUncompressed", "converts", "a", "Bitcoin", "public", "key", "to", "a", "65", "-", "byte", "byte", "slice", "without", "point", "compression", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L387-L399
148,777
vsergeev/btckeygenie
btckey/btckey.go
ToAddress
func (pub *PublicKey) ToAddress() (address string) { /* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */ /* Convert the public key to bytes */ pub_bytes := pub.ToBytes() /* SHA256 Hash */ sha256_h := sha256.New() sha256_h.Reset() sha256_h.Write(pub_bytes) pub_hash_1 := sha256_h.Sum(...
go
func (pub *PublicKey) ToAddress() (address string) { /* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */ /* Convert the public key to bytes */ pub_bytes := pub.ToBytes() /* SHA256 Hash */ sha256_h := sha256.New() sha256_h.Reset() sha256_h.Write(pub_bytes) pub_hash_1 := sha256_h.Sum(...
[ "func", "(", "pub", "*", "PublicKey", ")", "ToAddress", "(", ")", "(", "address", "string", ")", "{", "/* See https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses */", "/* Convert the public key to bytes */", "pub_bytes", ":=", "pub", ".", "ToBytes", "(", ...
// ToAddress converts a Bitcoin public key to a compressed Bitcoin address string.
[ "ToAddress", "converts", "a", "Bitcoin", "public", "key", "to", "a", "compressed", "Bitcoin", "address", "string", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/btckey.go#L447-L469
148,778
vsergeev/btckeygenie
btckey/elliptic.go
format
func (p *Point) format() string { if p.X == nil && p.Y == nil { return "(inf,inf)" } return fmt.Sprintf("(%s,%s)", hex.EncodeToString(p.X.Bytes()), hex.EncodeToString(p.Y.Bytes())) }
go
func (p *Point) format() string { if p.X == nil && p.Y == nil { return "(inf,inf)" } return fmt.Sprintf("(%s,%s)", hex.EncodeToString(p.X.Bytes()), hex.EncodeToString(p.Y.Bytes())) }
[ "func", "(", "p", "*", "Point", ")", "format", "(", ")", "string", "{", "if", "p", ".", "X", "==", "nil", "&&", "p", ".", "Y", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// format formats the bytes of a point for debugging.
[ "format", "formats", "the", "bytes", "of", "a", "point", "for", "debugging", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/elliptic.go#L43-L48
148,779
vsergeev/btckeygenie
btckey/elliptic.go
IsOnCurve
func (ec *EllipticCurve) IsOnCurve(P Point) bool { if ec.IsInfinity(P) { return false } /* y**2 = x**3 + a*x + b % p */ lhs := mulMod(P.Y, P.Y, ec.P) rhs := addMod( addMod( expMod(P.X, big.NewInt(3), ec.P), mulMod(ec.A, P.X, ec.P), ec.P), ec.B, ec.P) if lhs.Cmp(rhs) == 0 { return true } return...
go
func (ec *EllipticCurve) IsOnCurve(P Point) bool { if ec.IsInfinity(P) { return false } /* y**2 = x**3 + a*x + b % p */ lhs := mulMod(P.Y, P.Y, ec.P) rhs := addMod( addMod( expMod(P.X, big.NewInt(3), ec.P), mulMod(ec.A, P.X, ec.P), ec.P), ec.B, ec.P) if lhs.Cmp(rhs) == 0 { return true } return...
[ "func", "(", "ec", "*", "EllipticCurve", ")", "IsOnCurve", "(", "P", "Point", ")", "bool", "{", "if", "ec", ".", "IsInfinity", "(", "P", ")", "{", "return", "false", "\n", "}", "\n\n", "/* y**2 = x**3 + a*x + b % p */", "lhs", ":=", "mulMod", "(", "P", ...
// IsOnCurve checks if point P is on EllipticCurve ec.
[ "IsOnCurve", "checks", "if", "point", "P", "is", "on", "EllipticCurve", "ec", "." ]
413cbe3261adadbc974cecdbb4ea0b86c813c1a0
https://github.com/vsergeev/btckeygenie/blob/413cbe3261adadbc974cecdbb4ea0b86c813c1a0/btckey/elliptic.go#L128-L146
148,780
gocarina/gocsv
csv.go
LazyCSVReader
func LazyCSVReader(in io.Reader) CSVReader { csvReader := csv.NewReader(in) csvReader.LazyQuotes = true csvReader.TrimLeadingSpace = true return csvReader }
go
func LazyCSVReader(in io.Reader) CSVReader { csvReader := csv.NewReader(in) csvReader.LazyQuotes = true csvReader.TrimLeadingSpace = true return csvReader }
[ "func", "LazyCSVReader", "(", "in", "io", ".", "Reader", ")", "CSVReader", "{", "csvReader", ":=", "csv", ".", "NewReader", "(", "in", ")", "\n", "csvReader", ".", "LazyQuotes", "=", "true", "\n", "csvReader", ".", "TrimLeadingSpace", "=", "true", "\n", ...
// LazyCSVReader returns a lazy CSV reader, with LazyQuotes and TrimLeadingSpace.
[ "LazyCSVReader", "returns", "a", "lazy", "CSV", "reader", "with", "LazyQuotes", "and", "TrimLeadingSpace", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L72-L77
148,781
gocarina/gocsv
csv.go
MarshalString
func MarshalString(in interface{}) (out string, err error) { bufferString := bytes.NewBufferString(out) if err := Marshal(in, bufferString); err != nil { return "", err } return bufferString.String(), nil }
go
func MarshalString(in interface{}) (out string, err error) { bufferString := bytes.NewBufferString(out) if err := Marshal(in, bufferString); err != nil { return "", err } return bufferString.String(), nil }
[ "func", "MarshalString", "(", "in", "interface", "{", "}", ")", "(", "out", "string", ",", "err", "error", ")", "{", "bufferString", ":=", "bytes", ".", "NewBufferString", "(", "out", ")", "\n", "if", "err", ":=", "Marshal", "(", "in", ",", "bufferStri...
// MarshalString returns the CSV string from the interface.
[ "MarshalString", "returns", "the", "CSV", "string", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L97-L103
148,782
gocarina/gocsv
csv.go
MarshalBytes
func MarshalBytes(in interface{}) (out []byte, err error) { bufferString := bytes.NewBuffer(out) if err := Marshal(in, bufferString); err != nil { return nil, err } return bufferString.Bytes(), nil }
go
func MarshalBytes(in interface{}) (out []byte, err error) { bufferString := bytes.NewBuffer(out) if err := Marshal(in, bufferString); err != nil { return nil, err } return bufferString.Bytes(), nil }
[ "func", "MarshalBytes", "(", "in", "interface", "{", "}", ")", "(", "out", "[", "]", "byte", ",", "err", "error", ")", "{", "bufferString", ":=", "bytes", ".", "NewBuffer", "(", "out", ")", "\n", "if", "err", ":=", "Marshal", "(", "in", ",", "buffe...
// MarshalBytes returns the CSV bytes from the interface.
[ "MarshalBytes", "returns", "the", "CSV", "bytes", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L106-L112
148,783
gocarina/gocsv
csv.go
MarshalCSV
func MarshalCSV(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, false) }
go
func MarshalCSV(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, false) }
[ "func", "MarshalCSV", "(", "in", "interface", "{", "}", ",", "out", "*", "SafeCSVWriter", ")", "(", "err", "error", ")", "{", "return", "writeTo", "(", "out", ",", "in", ",", "false", ")", "\n", "}" ]
// MarshalCSV returns the CSV in writer from the interface.
[ "MarshalCSV", "returns", "the", "CSV", "in", "writer", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L132-L134
148,784
gocarina/gocsv
csv.go
MarshalCSVWithoutHeaders
func MarshalCSVWithoutHeaders(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, true) }
go
func MarshalCSVWithoutHeaders(in interface{}, out *SafeCSVWriter) (err error) { return writeTo(out, in, true) }
[ "func", "MarshalCSVWithoutHeaders", "(", "in", "interface", "{", "}", ",", "out", "*", "SafeCSVWriter", ")", "(", "err", "error", ")", "{", "return", "writeTo", "(", "out", ",", "in", ",", "true", ")", "\n", "}" ]
// MarshalCSVWithoutHeaders returns the CSV in writer from the interface.
[ "MarshalCSVWithoutHeaders", "returns", "the", "CSV", "in", "writer", "from", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L137-L139
148,785
gocarina/gocsv
csv.go
UnmarshalString
func UnmarshalString(in string, out interface{}) error { return Unmarshal(strings.NewReader(in), out) }
go
func UnmarshalString(in string, out interface{}) error { return Unmarshal(strings.NewReader(in), out) }
[ "func", "UnmarshalString", "(", "in", "string", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "Unmarshal", "(", "strings", ".", "NewReader", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalString parses the CSV from the string in the interface.
[ "UnmarshalString", "parses", "the", "CSV", "from", "the", "string", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L150-L152
148,786
gocarina/gocsv
csv.go
UnmarshalBytes
func UnmarshalBytes(in []byte, out interface{}) error { return Unmarshal(bytes.NewReader(in), out) }
go
func UnmarshalBytes(in []byte, out interface{}) error { return Unmarshal(bytes.NewReader(in), out) }
[ "func", "UnmarshalBytes", "(", "in", "[", "]", "byte", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "Unmarshal", "(", "bytes", ".", "NewReader", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalBytes parses the CSV from the bytes in the interface.
[ "UnmarshalBytes", "parses", "the", "CSV", "from", "the", "bytes", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L155-L157
148,787
gocarina/gocsv
csv.go
Unmarshal
func Unmarshal(in io.Reader, out interface{}) error { return readTo(newDecoder(in), out) }
go
func Unmarshal(in io.Reader, out interface{}) error { return readTo(newDecoder(in), out) }
[ "func", "Unmarshal", "(", "in", "io", ".", "Reader", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "readTo", "(", "newDecoder", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// Unmarshal parses the CSV from the reader in the interface.
[ "Unmarshal", "parses", "the", "CSV", "from", "the", "reader", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L160-L162
148,788
gocarina/gocsv
csv.go
UnmarshalWithoutHeaders
func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error { return readToWithoutHeaders(newDecoder(in), out) }
go
func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error { return readToWithoutHeaders(newDecoder(in), out) }
[ "func", "UnmarshalWithoutHeaders", "(", "in", "io", ".", "Reader", ",", "out", "interface", "{", "}", ")", "error", "{", "return", "readToWithoutHeaders", "(", "newDecoder", "(", "in", ")", ",", "out", ")", "\n", "}" ]
// UnmarshalWithoutHeaders parses the CSV from the reader in the interface.
[ "UnmarshalWithoutHeaders", "parses", "the", "CSV", "from", "the", "reader", "in", "the", "interface", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L165-L167
148,789
gocarina/gocsv
csv.go
UnmarshalToChan
func UnmarshalToChan(in io.Reader, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(newDecoder(in), c) }
go
func UnmarshalToChan(in io.Reader, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(newDecoder(in), c) }
[ "func", "UnmarshalToChan", "(", "in", "io", ".", "Reader", ",", "c", "interface", "{", "}", ")", "error", "{", "if", "c", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "return", "readEach", "("...
// UnmarshalToChan parses the CSV from the reader and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalToChan", "parses", "the", "CSV", "from", "the", "reader", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L186-L191
148,790
gocarina/gocsv
csv.go
UnmarshalDecoderToChan
func UnmarshalDecoderToChan(in SimpleDecoder, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(in, c) }
go
func UnmarshalDecoderToChan(in SimpleDecoder, c interface{}) error { if c == nil { return fmt.Errorf("goscv: channel is %v", c) } return readEach(in, c) }
[ "func", "UnmarshalDecoderToChan", "(", "in", "SimpleDecoder", ",", "c", "interface", "{", "}", ")", "error", "{", "if", "c", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ")", "\n", "}", "\n", "return", "readEach", "(",...
// UnmarshalDecoderToChan parses the CSV from the decoder and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalDecoderToChan", "parses", "the", "CSV", "from", "the", "decoder", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L195-L200
148,791
gocarina/gocsv
csv.go
UnmarshalStringToChan
func UnmarshalStringToChan(in string, c interface{}) error { return UnmarshalToChan(strings.NewReader(in), c) }
go
func UnmarshalStringToChan(in string, c interface{}) error { return UnmarshalToChan(strings.NewReader(in), c) }
[ "func", "UnmarshalStringToChan", "(", "in", "string", ",", "c", "interface", "{", "}", ")", "error", "{", "return", "UnmarshalToChan", "(", "strings", ".", "NewReader", "(", "in", ")", ",", "c", ")", "\n", "}" ]
// UnmarshalStringToChan parses the CSV from the string and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalStringToChan", "parses", "the", "CSV", "from", "the", "string", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L204-L206
148,792
gocarina/gocsv
csv.go
UnmarshalBytesToChan
func UnmarshalBytesToChan(in []byte, c interface{}) error { return UnmarshalToChan(bytes.NewReader(in), c) }
go
func UnmarshalBytesToChan(in []byte, c interface{}) error { return UnmarshalToChan(bytes.NewReader(in), c) }
[ "func", "UnmarshalBytesToChan", "(", "in", "[", "]", "byte", ",", "c", "interface", "{", "}", ")", "error", "{", "return", "UnmarshalToChan", "(", "bytes", ".", "NewReader", "(", "in", ")", ",", "c", ")", "\n", "}" ]
// UnmarshalBytesToChan parses the CSV from the bytes and send each value in the chan c. // The channel must have a concrete type.
[ "UnmarshalBytesToChan", "parses", "the", "CSV", "from", "the", "bytes", "and", "send", "each", "value", "in", "the", "chan", "c", ".", "The", "channel", "must", "have", "a", "concrete", "type", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L210-L212
148,793
gocarina/gocsv
csv.go
CSVToMap
func CSVToMap(in io.Reader) (map[string]string, error) { decoder := newDecoder(in) header, err := decoder.getCSVRow() if err != nil { return nil, err } if len(header) != 2 { return nil, fmt.Errorf("maps can only be created for csv of two columns") } m := make(map[string]string) for { line, err := decoder....
go
func CSVToMap(in io.Reader) (map[string]string, error) { decoder := newDecoder(in) header, err := decoder.getCSVRow() if err != nil { return nil, err } if len(header) != 2 { return nil, fmt.Errorf("maps can only be created for csv of two columns") } m := make(map[string]string) for { line, err := decoder....
[ "func", "CSVToMap", "(", "in", "io", ".", "Reader", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "decoder", ":=", "newDecoder", "(", "in", ")", "\n", "header", ",", "err", ":=", "decoder", ".", "getCSVRow", "(", ")", "\n",...
// CSVToMap creates a simple map from a CSV of 2 columns.
[ "CSVToMap", "creates", "a", "simple", "map", "from", "a", "CSV", "of", "2", "columns", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L283-L303
148,794
gocarina/gocsv
csv.go
CSVToMaps
func CSVToMaps(reader io.Reader) ([]map[string]string, error) { r := csv.NewReader(reader) rows := []map[string]string{} var header []string for { record, err := r.Read() if err == io.EOF { break } if err != nil { return nil, err } if header == nil { header = record } else { dict := map[st...
go
func CSVToMaps(reader io.Reader) ([]map[string]string, error) { r := csv.NewReader(reader) rows := []map[string]string{} var header []string for { record, err := r.Read() if err == io.EOF { break } if err != nil { return nil, err } if header == nil { header = record } else { dict := map[st...
[ "func", "CSVToMaps", "(", "reader", "io", ".", "Reader", ")", "(", "[", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "r", ":=", "csv", ".", "NewReader", "(", "reader", ")", "\n", "rows", ":=", "[", "]", "map", "[", "string", ...
// CSVToMaps takes a reader and returns an array of dictionaries, using the header row as the keys
[ "CSVToMaps", "takes", "a", "reader", "and", "returns", "an", "array", "of", "dictionaries", "using", "the", "header", "row", "as", "the", "keys" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/csv.go#L306-L329
148,795
gocarina/gocsv
encode.go
ensureInType
func ensureInType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
go
func ensureInType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
[ "func", "ensureInType", "(", "outType", "reflect", ".", "Type", ")", "error", "{", "switch", "outType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Slice", ":", "fallthrough", "\n", "case", "reflect", ".", "Array", ":", "return", "nil", "\n", ...
// Check if the inType is an array or a slice
[ "Check", "if", "the", "inType", "is", "an", "array", "or", "a", "slice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/encode.go#L114-L122
148,796
gocarina/gocsv
decode.go
maybeDoubleHeaderNames
func maybeDoubleHeaderNames(headers []string) error { headerMap := make(map[string]bool, len(headers)) for _, v := range headers { if _, ok := headerMap[v]; ok { return fmt.Errorf("Repeated header name: %v", v) } headerMap[v] = true } return nil }
go
func maybeDoubleHeaderNames(headers []string) error { headerMap := make(map[string]bool, len(headers)) for _, v := range headers { if _, ok := headerMap[v]; ok { return fmt.Errorf("Repeated header name: %v", v) } headerMap[v] = true } return nil }
[ "func", "maybeDoubleHeaderNames", "(", "headers", "[", "]", "string", ")", "error", "{", "headerMap", ":=", "make", "(", "map", "[", "string", "]", "bool", ",", "len", "(", "headers", ")", ")", "\n", "for", "_", ",", "v", ":=", "range", "headers", "{...
// Check that no header name is repeated twice
[ "Check", "that", "no", "header", "name", "is", "repeated", "twice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L114-L123
148,797
gocarina/gocsv
decode.go
ensureOutType
func ensureOutType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Chan: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
go
func ensureOutType(outType reflect.Type) error { switch outType.Kind() { case reflect.Slice: fallthrough case reflect.Chan: fallthrough case reflect.Array: return nil } return fmt.Errorf("cannot use " + outType.String() + ", only slice or array supported") }
[ "func", "ensureOutType", "(", "outType", "reflect", ".", "Type", ")", "error", "{", "switch", "outType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Slice", ":", "fallthrough", "\n", "case", "reflect", ".", "Chan", ":", "fallthrough", "\n", "cas...
// Check if the outType is an array or a slice
[ "Check", "if", "the", "outType", "is", "an", "array", "or", "a", "slice" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L304-L314
148,798
gocarina/gocsv
decode.go
ensureOutInnerType
func ensureOutInnerType(outInnerType reflect.Type) error { switch outInnerType.Kind() { case reflect.Struct: return nil } return fmt.Errorf("cannot use " + outInnerType.String() + ", only struct supported") }
go
func ensureOutInnerType(outInnerType reflect.Type) error { switch outInnerType.Kind() { case reflect.Struct: return nil } return fmt.Errorf("cannot use " + outInnerType.String() + ", only struct supported") }
[ "func", "ensureOutInnerType", "(", "outInnerType", "reflect", ".", "Type", ")", "error", "{", "switch", "outInnerType", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Struct", ":", "return", "nil", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "...
// Check if the outInnerType is of type struct
[ "Check", "if", "the", "outInnerType", "is", "of", "type", "struct" ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/decode.go#L317-L323
148,799
gocarina/gocsv
unmarshaller.go
NewUnmarshaller
func NewUnmarshaller(reader *csv.Reader, out interface{}) (*Unmarshaller, error) { headers, err := reader.Read() if err != nil { return nil, err } um := &Unmarshaller{reader: reader, outType: reflect.TypeOf(out)} err = validate(um, out, headers) if err != nil { return nil, err } return um, nil }
go
func NewUnmarshaller(reader *csv.Reader, out interface{}) (*Unmarshaller, error) { headers, err := reader.Read() if err != nil { return nil, err } um := &Unmarshaller{reader: reader, outType: reflect.TypeOf(out)} err = validate(um, out, headers) if err != nil { return nil, err } return um, nil }
[ "func", "NewUnmarshaller", "(", "reader", "*", "csv", ".", "Reader", ",", "out", "interface", "{", "}", ")", "(", "*", "Unmarshaller", ",", "error", ")", "{", "headers", ",", "err", ":=", "reader", ".", "Read", "(", ")", "\n", "if", "err", "!=", "n...
// NewUnmarshaller creates an unmarshaller from a csv.Reader and a struct.
[ "NewUnmarshaller", "creates", "an", "unmarshaller", "from", "a", "csv", ".", "Reader", "and", "a", "struct", "." ]
2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724
https://github.com/gocarina/gocsv/blob/2fc85fcf0c07e8bb9123b2104e84cfc2a5b53724/unmarshaller.go#L21-L33