Skip to content

afeiship/go-leancloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-leancloud

Leancloud sdk for golang.

installation

go get -u github.com/afeiship/go-leancloud

usage

package main

import (
	"fmt"
	"log"

	"github.com/afeiship/go-leancloud"
	"github.com/tidwall/gjson"
)

var client = leancloud.New()

func main() {
	// get
	result, err := client.Get("my_key")
	if err != nil {
		log.Fatalf("Failed to get key: %v", err)
	}
	fmt.Printf("Full result: %+v\n", result)

	// set
	err = client.Set("my_key", "my_value")
	if err != nil {
		log.Fatalf("Failed to set key: %v", err)
	}

	// value
	value, err := result.Value()
	if err != nil {
		log.Fatalf("Failed to get value: %v", err)
	}
	fmt.Printf("Value: %v\n", value)

	// get nested value
	value := result.Value
	age := gjson.Get(value, "age")
	fmt.Printf("Age: %v\n", age)
}

resources

About

Leancloud sdk for golang.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages