doublearray

package
v0.0.0-...-ad3a6f0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2014 License: MIT Imports: 4 Imported by: 40

Documentation

Overview

A URL router implemented by Double-Array Trie.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoubleArray

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

DoubleArray represents a URLRouter by Double-Array.

func New

func New() *DoubleArray

New returns a new DoubleArray.

func (*DoubleArray) Build

func (da *DoubleArray) Build(records []urlrouter.Record) error

Build builds Double-Array routing table from records.

func (*DoubleArray) Lookup

func (da *DoubleArray) Lookup(path string) (data interface{}, params []urlrouter.Param)

Lookup returns result data of lookup from Double-Array routing table by given path.

type DoubleArrayRouter

type DoubleArrayRouter struct{}

DoubleArrayRouter represents the Router of Double-Array.

func (*DoubleArrayRouter) New

func (router *DoubleArrayRouter) New() urlrouter.URLRouter

New returns a new URLRouter that implemented by Double-Array.

type Record

type Record struct {
	urlrouter.Record
	// contains filtered or unexported fields
}

Record represents a record that use to build the Double-Array.

type RecordSlice

type RecordSlice []*Record

RecordSlice represents a slice of Record for sort and implements the sort.Interface.

func (RecordSlice) Len

func (rs RecordSlice) Len() int

Len implements the sort.Interface.Len.

func (RecordSlice) Less

func (rs RecordSlice) Less(i, j int) bool

Less implements the sort.Interface.Less.

func (RecordSlice) Swap

func (rs RecordSlice) Swap(i, j int)

Swap implements the sort.Interface.Swap.

Jump to

Keyboard shortcuts

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