Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Application ¶
Example ¶
package main import ( "fmt" "unsafe" selfSym "bitbucket.org/taubyte/go-sdk-symbols/self" "bitbucket.org/taubyte/go-sdk/errno" "bitbucket.org/taubyte/go-sdk/self" ) func mockApplicationCall() { testApplicationId := "QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG" selfSym.ApplicationSize = func(sizePtr *uint32) errno.Error { *sizePtr = uint32(len(testApplicationId)) return 0 } selfSym.Application = func(ptr *byte) errno.Error { data := unsafe.Slice(ptr, len(testApplicationId)) copy(data, testApplicationId) return errno.ErrorNone } } func main() { mockApplicationCall() // Called from a function in the application "QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG" application, err := self.Application() if err != nil { panic(err) } fmt.Println(application) }
Output: QmYiQuR2K377j4ZUjxesY6a6oVvnLhzMMJsQSqmxrGZkyG
func Branch ¶
Example ¶
package main import ( "fmt" "unsafe" selfSym "bitbucket.org/taubyte/go-sdk-symbols/self" "bitbucket.org/taubyte/go-sdk/errno" "bitbucket.org/taubyte/go-sdk/self" ) func mockBranchCall() { testBranch := "master" selfSym.BranchSize = func(sizePtr *uint32) errno.Error { *sizePtr = uint32(len(testBranch)) return 0 } selfSym.Branch = func(ptr *byte) errno.Error { data := unsafe.Slice(ptr, len(testBranch)) copy(data, testBranch) return errno.ErrorNone } } func main() { mockBranchCall() // Called from a function in the branch "master" branch, err := self.Branch() if err != nil { panic(err) } fmt.Println(branch) }
Output: master
func Commit ¶
Example ¶
package main import ( "fmt" "unsafe" selfSym "bitbucket.org/taubyte/go-sdk-symbols/self" "bitbucket.org/taubyte/go-sdk/errno" "bitbucket.org/taubyte/go-sdk/self" ) func mockCommitCall() { testCommitId := "189d781643e5efc1d90130fc8e2c526f1040e10d" selfSym.CommitSize = func(sizePtr *uint32) errno.Error { *sizePtr = uint32(len(testCommitId)) return 0 } selfSym.Commit = func(ptr *byte) errno.Error { data := unsafe.Slice(ptr, len(testCommitId)) copy(data, testCommitId) return errno.ErrorNone } } func main() { mockCommitCall() // Called from a function with id "189d781643e5efc1d90130fc8e2c526f1040e10d" commit, err := self.Commit() if err != nil { panic(err) } fmt.Println(commit) }
Output: 189d781643e5efc1d90130fc8e2c526f1040e10d
func Function ¶
Example ¶
package main import ( "fmt" "unsafe" selfSym "bitbucket.org/taubyte/go-sdk-symbols/self" "bitbucket.org/taubyte/go-sdk/errno" "bitbucket.org/taubyte/go-sdk/self" ) func mockFunctionCall() { testFunctionId := "QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM" selfSym.IdSize = func(sizePtr *uint32) errno.Error { *sizePtr = uint32(len(testFunctionId)) return 0 } selfSym.Id = func(ptr *byte) errno.Error { data := unsafe.Slice(ptr, len(testFunctionId)) copy(data, testFunctionId) return errno.ErrorNone } } func main() { mockFunctionCall() // Called from a function with id "QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM" function, err := self.Function() if err != nil { panic(err) } fmt.Println(function) }
Output: QmNtG4SdhqrC3bEtz5euGZeEmaUhQrz6cSJ1LuEyu8Z5NM
func Project ¶
Example ¶
package main import ( "fmt" "unsafe" selfSym "bitbucket.org/taubyte/go-sdk-symbols/self" "bitbucket.org/taubyte/go-sdk/errno" "bitbucket.org/taubyte/go-sdk/self" ) func mockProjectCall() { testProjectId := "QmZY4u91d1YALDN2LTbpVtgwW8iT5cK9PE1bHZqX9J51Tv" selfSym.ProjectSize = func(sizePtr *uint32) errno.Error { *sizePtr = uint32(len(testProjectId)) return 0 } selfSym.Project = func(ptr *byte) errno.Error { data := unsafe.Slice(ptr, len(testProjectId)) copy(data, testProjectId) return errno.ErrorNone } } func main() { mockProjectCall() // 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.
Click to show internal directories.
Click to hide internal directories.