handle

package
v0.0.0-...-0a809af Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var Authors = []Author{
	Author{
		ID:           "0",
		Name:         "DoLim",
		ProfileImage: "https://api.adorable.io/avatars/285/dolim",
		Groups:       []*graphql.ID{&zero, &two},
	},
	Author{
		ID:           "1",
		Name:         "Collin",
		ProfileImage: "https://api.adorable.io/avatars/285/collin",
		Groups:       []*graphql.ID{&zero, &one},
	},
	Author{
		ID:           "2",
		Name:         "John",
		ProfileImage: "https://api.adorable.io/avatars/285/john",
		Groups:       []*graphql.ID{&one, &two},
	},
}

Authors is dummy data of Author

View Source
var Contents = []Content{

	Content{
		ID:         "0",
		TWLID:      "0",
		AuthorID:   "0",
		CreatedAt:  "2020-04-07",
		ModifiedAt: "2020-04-07",
		Text:       "First study of DoLim",
	},
	Content{
		ID:         "1",
		TWLID:      "0",
		AuthorID:   "1",
		CreatedAt:  "2020-04-07",
		ModifiedAt: "2020-04-07",
		Text:       "First study of Collin",
	},
	Content{
		ID:         "2",
		TWLID:      "1",
		AuthorID:   "1",
		CreatedAt:  "2020-04-07",
		ModifiedAt: "2020-04-07",
		Text:       "First exercise of Collin",
	},
	Content{
		ID:         "3",
		TWLID:      "1",
		AuthorID:   "2",
		CreatedAt:  "2020-04-07",
		ModifiedAt: "2020-04-07",
		Text:       "First exercise of John",
	},

	Content{
		ID:         "4",
		TWLID:      "0",
		AuthorID:   "0",
		CreatedAt:  "2020-04-08",
		ModifiedAt: "2020-04-08",
		Text:       "Second study of DoLim",
	},
	Content{
		ID:         "5",
		TWLID:      "0",
		AuthorID:   "1",
		CreatedAt:  "2020-04-08",
		ModifiedAt: "2020-04-08",
		Text:       "Second study of Collin",
	},
	Content{
		ID:         "6",
		TWLID:      "1",
		AuthorID:   "1",
		CreatedAt:  "2020-04-08",
		ModifiedAt: "2020-04-08",
		Text:       "Second exercise of Collin",
	},
	Content{
		ID:         "7",
		TWLID:      "1",
		AuthorID:   "2",
		CreatedAt:  "2020-04-08",
		ModifiedAt: "2020-04-08",
		Text:       "Second exercise of John",
	},

	Content{
		ID:         "8",
		TWLID:      "0",
		AuthorID:   "0",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "Third study of DoLim",
	},
	Content{
		ID:         "9",
		TWLID:      "0",
		AuthorID:   "1",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "Third study of Collin",
	},
	Content{
		ID:         "10",
		TWLID:      "1",
		AuthorID:   "1",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "Third exercise of Collin",
	},
	Content{
		ID:         "11",
		TWLID:      "1",
		AuthorID:   "2",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "Third exercise of John",
	},
	Content{
		ID:         "12",
		TWLID:      "2",
		AuthorID:   "0",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "First Coffee of Dolim",
	},
	Content{
		ID:         "13",
		TWLID:      "2",
		AuthorID:   "2",
		CreatedAt:  "2020-04-09",
		ModifiedAt: "2020-04-09",
		Text:       "First Coffee of John",
	},
}

Contents is dummy data of Content

View Source
var Groups = []Group{
	Group{
		ID:          "0",
		Title:       "Study",
		Description: "Group for Studying",
		Member:      []*graphql.ID{&zero, &one},
	},
	Group{
		ID:          "1",
		Title:       "Exercise",
		Description: "Group for Exercise",
		Member:      []*graphql.ID{&one, &two},
	},
	Group{
		ID:          "2",
		Title:       "Coffee",
		Description: "Group for making Coffee",
		Member:      []*graphql.ID{&zero, &two},
	},
}

Groups is dummy data of Group

View Source
var TWLs = []TWL{
	TWL{
		ID:      "0",
		GroupID: "0",
		Date:    "2020-04-07",
	},
	TWL{
		ID:      "1",
		GroupID: "1",
		Date:    "2020-04-07",
	},
	TWL{
		ID:      "2",
		GroupID: "0",
		Date:    "2020-04-08",
	},
	TWL{
		ID:      "3",
		GroupID: "1",
		Date:    "2020-04-08",
	},
	TWL{
		ID:      "4",
		GroupID: "0",
		Date:    "2020-04-09",
	},
	TWL{
		ID:      "5",
		GroupID: "1",
		Date:    "2020-04-09",
	},
	TWL{
		ID:      "6",
		GroupID: "2",
		Date:    "2020-04-09",
	},
}

TWLs is dummy data of TWL

Functions

This section is empty.

Types

type Author

type Author struct {
	ID           graphql.ID
	Name         string
	ProfileImage string
	Groups       []*graphql.ID
}

Author schema struct

func GetAuthor

func GetAuthor(authorID graphql.ID) (Author, error)

GetAuthor from DB

func GetAuthors

func GetAuthors(groupID graphql.ID) []Author

GetAuthors from DB

Example
res := GetAuthors("0")
fmt.Println(res)
Output:

[{0 DoLim https://api.adorable.io/avatars/285/dolim [0 2]} {1 Collin https://api.adorable.io/avatars/285/collin [0 1]}]

type AuthorArgs

type AuthorArgs struct {
	AuthorID graphql.ID
}

AuthorArgs type

type AuthorResolver

type AuthorResolver struct {
	// contains filtered or unexported fields
}

AuthorResolver is resolver of Author

func (AuthorResolver) Groups

func (r AuthorResolver) Groups() *[]*graphql.ID

Groups of Author

func (AuthorResolver) ID

func (r AuthorResolver) ID() graphql.ID

ID of Author

func (AuthorResolver) Name

func (r AuthorResolver) Name() string

Name of Author

func (AuthorResolver) ProfileImage

func (r AuthorResolver) ProfileImage() *string

ProfileImage of Author

type AuthorsArgs

type AuthorsArgs struct {
	GroupID graphql.ID
}

AuthorsArgs type

type Content

type Content struct {
	ID         graphql.ID
	TWLID      graphql.ID
	AuthorID   graphql.ID
	CreatedAt  string
	ModifiedAt string
	Text       string
}

Content schema struct

func GetContent

func GetContent(contentID graphql.ID) (Content, error)

GetContent from DB

func GetContents

func GetContents(twlID graphql.ID) []Content

GetContents from DB

type ContentArgs

type ContentArgs struct {
	ContentID graphql.ID
}

ContentArgs type

type ContentResolver

type ContentResolver struct {
	// contains filtered or unexported fields
}

ContentResolver is resolver of Content

func (*ContentResolver) AuthorID

func (r *ContentResolver) AuthorID() graphql.ID

AuthorID of Content

func (*ContentResolver) CreatedAt

func (r *ContentResolver) CreatedAt() string

CreatedAt of Content

func (*ContentResolver) ID

func (r *ContentResolver) ID() graphql.ID

ID of Content

func (*ContentResolver) ModifiedAt

func (r *ContentResolver) ModifiedAt() string

ModifiedAt of Content

func (*ContentResolver) TWLID

func (r *ContentResolver) TWLID() graphql.ID

TWLID of Content

func (*ContentResolver) Text

func (r *ContentResolver) Text() string

Text of Content

type ContentsArgs

type ContentsArgs struct {
	TwlID graphql.ID
}

ContentsArgs type

type Group

type Group struct {
	ID          graphql.ID
	Title       string
	Description string
	Member      []*graphql.ID
	TWLs        []*graphql.ID
}

Group schema struct

func GetGroup

func GetGroup(groupID graphql.ID) (Group, error)

GetGroup from DB

Example
res, err := GetGroup("1")
if err != nil {
	panic(err)
}
fmt.Println(res)
Output:

{1 Exercise Group for Exercise [1 2] []}

func GetGroups

func GetGroups(title string) []Group

GetGroups from DB

Example
res := GetGroups("Study")
fmt.Println(res)
Output:

[{0 Study Group for Studying [0 1] []}]

type GroupArgs

type GroupArgs struct {
	GroupID graphql.ID
}

GroupArgs type

type GroupResolver

type GroupResolver struct {
	// contains filtered or unexported fields
}

GroupResolver is resolver of Group

func (*GroupResolver) Description

func (r *GroupResolver) Description() string

Description of Group

func (*GroupResolver) ID

func (r *GroupResolver) ID() graphql.ID

ID of Group

func (*GroupResolver) Member

func (r *GroupResolver) Member() *[]*graphql.ID

Member of Group

func (*GroupResolver) TWLs

func (r *GroupResolver) TWLs() *[]*graphql.ID

TWLs of Group

func (*GroupResolver) Title

func (r *GroupResolver) Title() string

Title of Group

type GroupsArgs

type GroupsArgs struct {
	Title *string
}

GroupsArgs type

type RootResolver

type RootResolver struct{}

RootResolver struct

func (*RootResolver) Author

func (*RootResolver) Author(args AuthorArgs) AuthorResolver

Author query resolver

func (*RootResolver) Authors

func (*RootResolver) Authors(args AuthorsArgs) *[]*AuthorResolver

Authors query resolver

func (*RootResolver) Content

func (*RootResolver) Content(args ContentArgs) ContentResolver

Content query resolver

func (*RootResolver) Contents

func (*RootResolver) Contents(args ContentsArgs) []*ContentResolver

Contents query resolver

func (*RootResolver) Group

func (*RootResolver) Group(args GroupArgs) GroupResolver

Group query resolver

func (*RootResolver) Groups

func (*RootResolver) Groups(args GroupsArgs) *[]*GroupResolver

Groups query resolver

func (*RootResolver) TWL

func (*RootResolver) TWL(args TWLArgs) TWLResolver

TWL query resolver

func (*RootResolver) TWLs

func (*RootResolver) TWLs(args TWLsArgs) *[]*TWLResolver

TWLs query resolver

type TWL

type TWL struct {
	ID       graphql.ID
	GroupID  graphql.ID
	Date     string
	Contents []*graphql.ID
}

TWL schema struct

func GetTWL

func GetTWL(twlID graphql.ID) (TWL, error)

GetTWL from DB

func GetTWLs

func GetTWLs(groupID graphql.ID) []TWL

GetTWLs from DB

type TWLArgs

type TWLArgs struct {
	TwlID graphql.ID
}

TWLArgs type

type TWLResolver

type TWLResolver struct {
	// contains filtered or unexported fields
}

TWLResolver is resolver of TWL

func (TWLResolver) Contents

func (r TWLResolver) Contents() *[]*graphql.ID

Contents of TWL

func (TWLResolver) Date

func (r TWLResolver) Date() string

Date of TWL

func (TWLResolver) GroupID

func (r TWLResolver) GroupID() graphql.ID

GroupID of TWL

func (TWLResolver) ID

func (r TWLResolver) ID() graphql.ID

ID of TWL

type TWLsArgs

type TWLsArgs struct {
	GroupID graphql.ID
}

TWLsArgs type

Jump to

Keyboard shortcuts

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