model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompatibilityProp = "compatibility"
)

Variables

View Source
var MajorVerRegExp = regexp.MustCompile("^v(0|[1-9][0-9]*)$")
View Source
var Properties map[string]string
View Source
var SemVerRegExp = regexp.MustCompile("^v((0|[1-9][0-9]*)\\.){2}(0|[1-9][0-9]*)$")

Functions

func IsMajorVer added in v0.3.0

func IsMajorVer(version string) bool

func IsSemVer

func IsSemVer(version string) bool

IsSemVer checks if the given version string is valid form of semantic version and return true when it is valid.

func ListProperties added in v0.3.0

func ListProperties() []string

Types

type ClientError

type ClientError []error

type Compatibility

type Compatibility struct {
	IsCompatible bool `json:"is_compatible"`
}

type Config

type Config struct {
	Compatibility string `json:"compatibility"`
}

type Error

type Error struct {
	*ServerError
	ClientError
}

func NewError

func NewError(serverError *ServerError, clientError []error) *Error

func (*Error) Error

func (err *Error) Error() string

func (*Error) Messages

func (err *Error) Messages() []string

type Property

type Property struct {
	Subject  string `json:"subject"`
	Property string `json:"property"`
	Value    string `json:"value"`
}

type Schema

type Schema struct {
	Id         int64  `json:"id"`
	Subject    string `json:"subject"`
	Version    SemVer `json:"version"`
	Definition string `json:"schema"`
}

func (Schema) MarshalJSON

func (s Schema) MarshalJSON() ([]byte, error)

func (*Schema) UnmarshalJSON

func (s *Schema) UnmarshalJSON(data []byte) error

type SchemaId

type SchemaId struct {
	Id int64 `json:"id"`
}

func (*SchemaId) UnmarshalJSON

func (sid *SchemaId) UnmarshalJSON(data []byte) error

type SemVer

type SemVer struct {
	Major int
	Minor int
	Patch int
}

SemVer is the version that represents compatibility between schemas manged in typebook.

func NewSemVer

func NewSemVer(version string) (*SemVer, error)

NewSemVer create a instance of SemVer from a given version string. If a given version string is not a valid format, this returns an error. Valid form has leading "v" and following 3 integers separated by "." (e.g. v1.0.0).

func (*SemVer) String

func (sv *SemVer) String() string

type ServerError

type ServerError struct {
	ErrorCode int    `json:"error_code"`
	Message   string `json:"message"`
}

func (*ServerError) Error

func (se *ServerError) Error() string

type Subject

type Subject struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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