/
schema.go
36 lines (33 loc) · 1.54 KB
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2023 The flatgeobuf (Go) Authors. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package flatgeobuf
import "github.com/gogama/flatgeobuf/flatgeobuf/flat"
// Schema is a schema for FlatGeobuf's feature property format. It
// documents the number of available properties (ColumnsLength) for a
// feature and the property definition (flat.Column) for each property.
//
// Both the header structure (flat.Header) of a FlatGeobuf file and an
// individual feature within the data section (flat.Feature) implement
// Schema. When provided on the header table, the Schema applies to all
// features in the data section, except those features that have their
// own dedicated schema. When provided on an individual feature, the
// Schema applies only to that feature.
//
// Use PropReader.ReadSchema to read all properties from a FlatGeobuf
// properties buffer that is serialized according to a particular
// schema.
type Schema interface {
// ColumnsLength returns the number of columns, i.e. properties, in
// the schema.
ColumnsLength() int
// Columns obtains the metadata for the column, i.e. property, at a
// specific index.
//
// The index j may range from 0 to ColumnsLength()-1. The pointer
// obj must not be nil. On return, obj points to the property
// metadata (flat.Column) for property j and the return value is
// true. A return value of false indicates that no property metadata
// was found for the property at index j.
Columns(obj *flat.Column, j int) bool
}