github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/table/storage/query_test.go (about) 1 package storageTable_test 2 3 import ( 4 "github.com/alecthomas/units" 5 structureSpec "github.com/taubyte/go-specs/structure" 6 storageTable "github.com/taubyte/tau-cli/table/storage" 7 ) 8 9 func ExampleQuery_object() { 10 storage := &structureSpec.Storage{ 11 Id: "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH", 12 Name: "someProject", 13 Description: "this is a storage of some type", 14 Tags: []string{"apple", "orange", "banana"}, 15 Match: "/test/v1", 16 Regex: false, 17 Type: "Object", 18 Public: false, 19 Size: uint64(39 * units.MB), 20 Versioning: false, 21 } 22 23 storageTable.Query(storage) 24 25 // Output: 26 // ┌────────────────┬────────────────────────────────────────────────┐ 27 // │ ID │ QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH │ 28 // ├────────────────┼────────────────────────────────────────────────┤ 29 // │ Name │ someProject │ 30 // ├────────────────┼────────────────────────────────────────────────┤ 31 // │ Description │ this is a storage of some type │ 32 // ├────────────────┼────────────────────────────────────────────────┤ 33 // │ Tags │ apple, orange, banana │ 34 // ├────────────────┼────────────────────────────────────────────────┤ 35 // │ Access │ │ 36 // ├────────────────┼────────────────────────────────────────────────┤ 37 // │ - Network │ host │ 38 // ├────────────────┼────────────────────────────────────────────────┤ 39 // │ Object │ │ 40 // ├────────────────┼────────────────────────────────────────────────┤ 41 // │ - Versioning │ false │ 42 // ├────────────────┼────────────────────────────────────────────────┤ 43 // │ - Size │ 39MB │ 44 // └────────────────┴────────────────────────────────────────────────┘ 45 } 46 func ExampleQuery_streaming() { 47 storage := &structureSpec.Storage{ 48 Id: "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH", 49 Name: "someProject", 50 Description: "this is a storage of some type", 51 Tags: []string{"apple", "orange", "banana"}, 52 Match: "/test/v1", 53 Regex: false, 54 Type: "Streaming", 55 Public: true, 56 Size: uint64(4 * units.MB), 57 Ttl: 50000, 58 } 59 60 storageTable.Query(storage) 61 62 // Output: 63 // ┌─────────────┬────────────────────────────────────────────────┐ 64 // │ ID │ QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH │ 65 // ├─────────────┼────────────────────────────────────────────────┤ 66 // │ Name │ someProject │ 67 // ├─────────────┼────────────────────────────────────────────────┤ 68 // │ Description │ this is a storage of some type │ 69 // ├─────────────┼────────────────────────────────────────────────┤ 70 // │ Tags │ apple, orange, banana │ 71 // ├─────────────┼────────────────────────────────────────────────┤ 72 // │ Access │ │ 73 // ├─────────────┼────────────────────────────────────────────────┤ 74 // │ - Network │ all │ 75 // ├─────────────┼────────────────────────────────────────────────┤ 76 // │ Streaming │ │ 77 // ├─────────────┼────────────────────────────────────────────────┤ 78 // │ - TTL │ 50µs │ 79 // ├─────────────┼────────────────────────────────────────────────┤ 80 // │ - Size │ 4MB │ 81 // └─────────────┴────────────────────────────────────────────────┘ 82 }