wiki/wiki/storage/interface.go
2017-02-10 18:52:07 +01:00

37 lines
923 B
Go

package storage
type Storage interface {
TermStorage
ContentStorage
DiffStorage
}
type TermStorage interface {
CreateTerm(term *Term) error
UpdateTerm(term *Term) error
RemoveTerm(term *Term) error
GetTermByName(name string) (*Term, error)
GetTermBySlug(slug string) (*Term, error)
GetTermByID(id string) (*Term, error)
GetTerms() ([]Term, error)
GenerateSlug(name string) string
}
type ContentStorage interface {
CreateContent(content *Content) error
UpdateContent(content *Content) error
RemoveContent(content *Content) error
GetContentByTermName(termName string) (*Content, error)
GetContentByTermID(termID string) (*Content, error)
GetContentByID(id string) (*Content, error)
GetContents() ([]Content, error)
}
type DiffStorage interface {
CreateDiff(diff *Diff) error
UpdateDiff(diff *Diff) error
RemoveDiff(diff *Diff) error
GetDiff(term string) (*Diff, error)
GetDiffs() ([]Diff, error)
}