Skip to content
Parse.com API Client Library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
common_test.go
create.go
create_test.go
delete.go
delete_test.go
doc.go
function.go
push.go ran gofmt on push and rest Oct 19, 2017
query.go
query_test.go
rate_limit.go
rest.go
session.go
session_test.go
types.go added support for `.ServerURL` in the style of Parse Platform SDK sty… Oct 19, 2017
types_test.go
update.go
update_test.go
util.go
util_test.go

README.md

Parse

Build Status Godoc license Go Report Card

This package provides a client for Parse's REST API. So far, it supports most of the query operations provided by Parse's Javascript library, with a few exceptions (listed below under TODO).

Installation

go get github.com/kylemcc/parse

Documentation

Full documentation is provided by godoc.org

Usage:

package main

import (
	"fmt"
	"time"

	"github.com/kylemcc/parse"
)

func main() {
	parse.Initialize("APP_ID", "REST_KEY", "MASTER_KEY") // rest and master keys are optional
	parse.ServerURL("https://SERVER_URL/PATH")
	user := parse.User{}
	q, err := parse.NewQuery(&user)
	if err != nil {
		panic(err)
	}
	q.EqualTo("email", "kylemcc@gmail.com")
	q.GreaterThan("numFollowers", 10).OrderBy("-createdAt") // API is chainable
	err := q.First()
	if err != nil {
		if pe, ok := err.(parse.ParseError); ok {
			fmt.Printf("Error querying parse: %d - %s\n", pe.Code(), pe.Message())
		}
	}

	fmt.Printf("Retrieved user with id: %s\n", user.Id)

	q2, _ := parse.NewQuery(&parse.User{})
	q2.GreaterThan("createdAt", time.Date(2014, 01, 01, 0, 0, 0, 0, time.UTC))

	rc := make(chan *parse.User)

	// .Each will retrieve all results for a query and send them to the provided channel
	// The iterator returned allows for early cancelation of the iteration process, and
	// stores any error that triggers early termination
	iterator, err := q2.Each(rc)
	for u := range rc {
		fmt.Printf("received user: %v\n", u)
		// Do something
		if err := process(u); err != nil {
			// Cancel if there was an error
			iterator.Cancel()
		}
	}

	// An error occurred - not all rows were processed
	if it.Error() != nil {
		panic(it.Error())
	}
}

TODO

  • Missing query operations
    • Related to
  • Missing CRUD operations:
    • Update
      • Field ops (__op):
        • AddRelation
        • RemoveRelation
  • Roles
  • Background Jobs
  • Analytics
  • File upload/retrieval
  • Batch operations
You can’t perform that action at this time.