postmi

package module
v0.0.0-...-4ca9e62 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2015 License: MIT Imports: 7 Imported by: 0

README

postmi

articles microservice

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, driver Store)

Types

type Config

type Config struct {
	App struct {
		Port          int
		TemplatesPath string
		AssetPath     string
		Prefix        string
	}
	Admin struct {
		Login    string
		Password string
	}
	DataBase struct {
		Driver  string
		Setting string
	}
}

type Post

type Post struct {
	Id    int64  `json:"id"`
	Title string `json:"title"`
	Body  string `json:"body"`

	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
	Deleted time.Time `json:"deleted"`
}

func NewPostFromJSON

func NewPostFromJSON(data []byte) (*Post, error)

func (*Post) JSON

func (p *Post) JSON() ([]byte, error)

func (*Post) MustJSON

func (p *Post) MustJSON() []byte

type Service

type Service struct {
	Store Store

	Config
}

func New

func New(confPath string) (*Service, error)

func NewWithConfig

func NewWithConfig(cfg Config) (*Service, error)

func (*Service) Run

func (s *Service) Run() error

type Store

type Store interface {
	Connect(string) error

	Save(*Post) error
	Get(int64) (*Post, error)
	Delete(int64) error

	GetSlice(int64, int64) ([]*Post, error)
}

func Open

func Open(name string, setting string) (Store, error)

Directories

Path Synopsis
cmd
store

Jump to

Keyboard shortcuts

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