model

package
v0.0.0-...-45d6836 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Post

type Post struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	CreatedAt time.Time `json:"createdAt"`
	UserLogin string    `json:"userLogin"`
	Body      *string   `json:"body"`
}

Post is a struct representing one post

func (*Post) FromIOReader

func (p *Post) FromIOReader(reader io.Reader) error

FromIOReader Creates a new post from a IOReader

func (*Post) FromJSONData

func (p *Post) FromJSONData(data []byte) error

FromJSONData Create a new post object from a json

func (*Post) ToJSONData

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

ToJSONData return JSON representation of the object

type PostBody

type PostBody struct {
	Text string `json:"text"`
}

PostBody represents the body of a post, let this be just a string for now

type User

type User struct {
	Login          string    `json:"login"`
	CreatedAt      time.Time `json:"createdAt"`
	Email          string    `json:"email"`
	HashedPassword []byte    `json:"password"`
}

User is a struct represinting a user - for now

func (*User) FromJSON

func (p *User) FromJSON(data []byte) error

FromJSON Create a new user object from a json

Jump to

Keyboard shortcuts

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