dockersort

package module
v0.0.0-...-127186d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2014 License: MIT Imports: 1 Imported by: 1

README

go-dockerclient-sort

Build Status Build Status GoDoc Coverage Status

For sorting the results of Docker API calls made using https://github.com/fsouza/go-dockerclient

Example usage:

package main

import(
	"fmt"

	"github.com/fsouza/go-dockerclient"
	"github.com/rafecolton/go-dockerclient-sort"
)

func main() {
	var endpoint = "unix:///var/run/docker.sock"
	var client, _ = docker.NewClient(endpoint)

	images, _ := client.ListImages(false)
	sort.Sort(dockersort.ByCreatedDescending(images))
	fmt.Printf("sorted images: %+v\n", images)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByCreatedAscending

type ByCreatedAscending []docker.APIImages

ByCreatedAscending is a type that wraps []APIImages so that it can be sorted using the "sort" package Interface. It sorts by the created value in descending order, which means the oldest image will appear first

func (ByCreatedAscending) Len

func (slice ByCreatedAscending) Len() int

func (ByCreatedAscending) Less

func (slice ByCreatedAscending) Less(i, j int) bool

func (ByCreatedAscending) Swap

func (slice ByCreatedAscending) Swap(i, j int)

type ByCreatedDescending

type ByCreatedDescending []docker.APIImages

ByCreatedDescending is a type that wraps []APIImages so that it can be sorted using the "sort" package Interface. It sorts by the created value in descending order, which means the newest image will appear first

func (ByCreatedDescending) Len

func (slice ByCreatedDescending) Len() int

func (ByCreatedDescending) Less

func (slice ByCreatedDescending) Less(i, j int) bool

func (ByCreatedDescending) Swap

func (slice ByCreatedDescending) Swap(i, j int)

Jump to

Keyboard shortcuts

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