self

package
Version: v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application

func Application() (string, error)
Example
package main

import (
	"fmt"

	selfSym "bitbucket.org/taubyte/go-sdk-symbols/self"
	"bitbucket.org/taubyte/go-sdk/self"
)

func main() {
	// Mocking the calls to the vm for usage in tests and playground
	selfSym.MockApplication("QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG")

	// Called from a function in the application "QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG"
	application, err := self.Application()
	if err != nil {
		panic(err)
	}

	fmt.Println(application)
}
Output:

QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG

func Branch

func Branch() (string, error)
Example
package main

import (
	"fmt"

	selfSym "bitbucket.org/taubyte/go-sdk-symbols/self"
	"bitbucket.org/taubyte/go-sdk/self"
)

func main() {
	// Mocking the calls to the vm for usage in tests and playground
	selfSym.MockBranch("master")

	// Called from a function in the branch "master"
	branch, err := self.Branch()
	if err != nil {
		panic(err)
	}

	fmt.Println(branch)
}
Output:

master

func Commit

func Commit() (string, error)
Example
package main

import (
	"fmt"

	selfSym "bitbucket.org/taubyte/go-sdk-symbols/self"
	"bitbucket.org/taubyte/go-sdk/self"
)

func main() {
	// Mocking the calls to the vm for usage in tests and playground
	selfSym.MockCommit("189d781643e5efc1d90130fc8e2c526f1040e10d")

	// Called from a function with id "189d781643e5efc1d90130fc8e2c526f1040e10d"
	commit, err := self.Commit()
	if err != nil {
		panic(err)
	}

	fmt.Println(commit)
}
Output:

189d781643e5efc1d90130fc8e2c526f1040e10d

func Function

func Function() (string, error)
Example
package main

import (
	"fmt"

	selfSym "bitbucket.org/taubyte/go-sdk-symbols/self"
	"bitbucket.org/taubyte/go-sdk/self"
)

func main() {
	// Mocking the calls to the vm for usage in tests and playground
	selfSym.MockFunction("QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM")

	// Called from a function with id "QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM"
	function, err := self.Function()
	if err != nil {
		panic(err)
	}

	fmt.Println(function)
}
Output:

QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM

func Project

func Project() (string, error)
Example
package main

import (
	"fmt"

	selfSym "bitbucket.org/taubyte/go-sdk-symbols/self"
	"bitbucket.org/taubyte/go-sdk/self"
)

func main() {
	// Mocking the calls to the vm for usage in tests and playground
	selfSym.MockProject("QmZY4u91d1YALDN2LTbpVtgwW8iT5cK9PE1bHZqX9J51Tv")

	// Called from a function in the project "QmZY4u91d1YALDN2LTbpVtgwW8iT5cK9PE1bHZqX9J51Tv"
	project, err := self.Project()
	if err != nil {
		panic(err)
	}

	fmt.Println(project)
}
Output:

QmZY4u91d1YALDN2LTbpVtgwW8iT5cK9PE1bHZqX9J51Tv

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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