Documentation ¶
Overview ¶
Package types provides various common types.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
NopCloser is an io.Closer that does nothing.
Functions ¶
func NewStatsReadSeeker ¶
func NewStatsReadSeeker(v *expvar.Int, r io.ReadSeeker) io.ReadSeeker
NewReaderStats returns an io.ReadSeeker that will have the number of bytes read from rs added to v.
func NewStatsReader ¶
NewReaderStats returns an io.Reader that will have the number of bytes read from r added to v.
Example ¶
var ( // r is the io.Reader we'd like to count read from. r = strings.NewReader("Hello world") v = expvar.NewInt("read-bytes") sw = NewStatsReader(v, r) ) // Read from the wrapped io.Reader, StatReader will count the bytes. io.Copy(ioutil.Discard, sw) fmt.Printf("Read %s bytes\n", v.String())
Output: Read 11 bytes
Types ¶
type AtomicBool ¶
type AtomicBool struct {
// contains filtered or unexported fields
}
AtomicBool is an atomic boolean. It can be accessed from concurrent goroutines.
func (*AtomicBool) Get ¶
func (b *AtomicBool) Get() bool
func (*AtomicBool) Set ¶
func (b *AtomicBool) Set(v bool)
type AtomicInt64 ¶
type AtomicInt64 struct {
// contains filtered or unexported fields
}
func (*AtomicInt64) Add ¶
func (a *AtomicInt64) Add(delta int64) int64
func (*AtomicInt64) Get ¶
func (a *AtomicInt64) Get() int64
func (*AtomicInt64) Set ¶
func (a *AtomicInt64) Set(v int64)
type InvertedBool ¶
type InvertedBool bool
InvertedBool is a bool that marshals to and from JSON with the opposite of its in-memory value.
func (InvertedBool) MarshalJSON ¶
func (ib InvertedBool) MarshalJSON() ([]byte, error)
func (*InvertedBool) UnmarshalJSON ¶
func (ib *InvertedBool) UnmarshalJSON(b []byte) error
type ReadSeekCloser ¶
A ReadSeekCloser can Read, Seek, and Close.
type SizeReaderAt ¶
type Time3339 ¶
Time3339 is a time.Time which encodes to and from JSON as an RFC 3339 time in UTC.
func ParseTime3339OrNil ¶
func ParseTime3339OrZero ¶
ParseTime3339OrZero parses a string in RFC3339 format. If it's invalid, the zero time value is returned instead.
func (Time3339) MarshalJSON ¶
func (Time3339) Time ¶
Time returns the time as a time.Time with slightly less stutter than a manual conversion.
func (*Time3339) UnmarshalJSON ¶
Directories ¶
Path | Synopsis |
---|---|
Package camtypes is like the types package, but higher-level and contains Camlistore-specific types.
|
Package camtypes is like the types package, but higher-level and contains Camlistore-specific types. |
Package clientconfig provides types related to the client configuration file.
|
Package clientconfig provides types related to the client configuration file. |
Package serverconfig provides types related to the server configuration file.
|
Package serverconfig provides types related to the server configuration file. |