25 lines
388 B
Go
25 lines
388 B
Go
package models
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
// Direction is either up or down.
|
|
type Direction string
|
|
|
|
const (
|
|
Down Direction = "down"
|
|
Up Direction = "up"
|
|
)
|
|
|
|
var (
|
|
ErrParse = fmt.Errorf("no match")
|
|
)
|
|
|
|
// Regex matches the following pattern:
|
|
//
|
|
// 123_name.up.ext
|
|
// 123_name.down.ext
|
|
var Regex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(Down) + `|` + string(Up) + `)\.(.*)$`)
|