go/drive_example_test.go
Snider e65cbde97e feat: complete per-file examples — 54 examples across 17 files
New example files: entitlement, task, lock, log, drive, config,
command, info. Every major source file now has a dedicated
*_example_test.go with compilable, tested examples.

561 tests, 84.8% coverage.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 18:39:36 +00:00

36 lines
649 B
Go

package core_test
import (
"fmt"
. "dappco.re/go/core"
)
func ExampleDrive_New() {
c := New()
c.Drive().New(NewOptions(
Option{Key: "name", Value: "forge"},
Option{Key: "transport", Value: "https://forge.lthn.ai"},
))
fmt.Println(c.Drive().Has("forge"))
fmt.Println(c.Drive().Names())
// Output:
// true
// [forge]
}
func ExampleDrive_Get() {
c := New()
c.Drive().New(NewOptions(
Option{Key: "name", Value: "charon"},
Option{Key: "transport", Value: "http://10.69.69.165:9101"},
))
r := c.Drive().Get("charon")
if r.OK {
h := r.Value.(*DriveHandle)
fmt.Println(h.Transport)
}
// Output: http://10.69.69.165:9101
}