semvertree

package module
v0.0.0-...-27d03ef Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

semver-tree

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(a, b string) int

func DegreeOfDifference

func DegreeOfDifference(a, b string) int

Types

type Tree

type Tree struct {
	Left  *Tree
	Value *Value
	Right *Tree
}

A Tree is a binary tree with values.

type Value

type Value struct {
	Version string
	Data    interface{}
}

Value is an element in tree

type VersionTree

type VersionTree struct {
	Root *Tree
}

VersionTree is a wrapper struct for all functions

func New

func New() *VersionTree

New returns just an empty instance

func (*VersionTree) Add

func (b *VersionTree) Add(value *Value)

Add allow insterting a data

func (*VersionTree) AddVersion

func (b *VersionTree) AddVersion(version string, data interface{})

AddVersion allow insterting a data

func (*VersionTree) Rebuild

func (b *VersionTree) Rebuild()

Rebuild with sorted versions

func (*VersionTree) Walk

func (b *VersionTree) Walk(step func(prev, next *Value, degreeOfDifference int))

Walk lets you iterate over whole data

Jump to

Keyboard shortcuts

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