swriter

package module
v0.0.0-...-fd96e23 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2015 License: MIT Imports: 3 Imported by: 0

README

swrite

Go library that implements a SlowWriter PACKAGE DOCUMENTATION

PACKAGE DOCUMENTATION

package swriter
    import "."

    Package swriter implements a buffered writer that dumps Writes with a
    maxium frequence. SlowWriter will save the content of the Writes and
    dump after it timesout.

	w := swriter.New(os.Stdout, time.Second / 60)
	w.Write("hello")
	w.Write("world")
	// After 1/60 seconds it will dump to os.Stdout all the previous writes.

TYPES

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

func New(w io.Writer, d time.Duration) *SlowWriter
    New returns a new SlowWriter

func (w *SlowWriter) Close() error
    Close stops the internal gorutines and return any error that could
    happen during Writes

func (w *SlowWriter) Flush()
    Flush will inmediatly flush all the data

func (w *SlowWriter) Write(data []byte) (int, error)
    Write will queue the data to be send and wait a max of the time specify
    during creation

Documentation

Overview

Package swriter implements a buffered writer that dumps Writes with a maxium frequence. SlowWriter will save the content of the Writes and dump after it timesout.

w := swriter.New(os.Stdout, time.Second / 60)
w.Write("hello")
w.Write("world")
// After 1/60 seconds it will dump to os.Stdout all the previous writes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlowWriter

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

func New

func New(w io.Writer, d time.Duration) *SlowWriter

New returns a new SlowWriter

func (*SlowWriter) Close

func (w *SlowWriter) Close() error

Close stops the internal gorutines and return any error that could happen during Writes

func (*SlowWriter) Flush

func (w *SlowWriter) Flush()

Flush will inmediatly flush all the data

func (*SlowWriter) Write

func (w *SlowWriter) Write(data []byte) (int, error)

Write will queue the data to be send and wait a max of the time specify during creation

Jump to

Keyboard shortcuts

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