gls

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2017 License: Apache-2.0 Imports: 5 Imported by: 1

README

gls

Go Report Card GoDoc

gls is a goroutine-local storage for golang.

Installation

gls is available using the standard go get command.

To install gls, simply run:

go get github.com/subchen/gls

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

License

gls is released under the Apache 2.0 license. See LICENSE

Documentation

Overview

Package gls implements goroutine-local storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear removes all gls associated with this goroutine. If this is not called, the gls may persist for the lifetime of your application. This must be called from the very first goroutine to invoke Set

func Copy

func Copy(src map[string]interface{})

Copy sets multiple values and associates it with the current goroutine.

func Get

func Get(key string) interface{}

Get gets the value by key as it exists for the current goroutine.

func GetOK

func GetOK(key string) (value interface{}, ok bool)

GetOK gets the value by key as it exists for the current goroutine.

func GoroutineID

func GoroutineID() uint64

GoroutineID returns a goroutine ID Reference: http://blog.sgmansfield.com/2015/12/goroutine-ids/

func Keys

func Keys() []string

func RawMap

func RawMap() map[string]interface{}

func Remove

func Remove(key string)

Remove removes key from the CopyOnWriteMap.

func Set

func Set(key string, value interface{})

Set sets the value by key and associates it with the current goroutine.

func Values

func Values() []interface{}

Types

This section is empty.

Jump to

Keyboard shortcuts

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