github.com/creachadair/ffs@v0.17.3/index/indexpb/types.go (about) 1 // Copyright 2021 Michael J. Fromberger. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package indexpb defines the storage encoding of a Bloom filter index. 16 // Most of this package is generated by the protocol buffer compiler from the 17 // schema in index/indexpb/index.proto. 18 package indexpb 19 20 import "google.golang.org/protobuf/encoding/protojson" 21 22 //go:generate go install google.golang.org/protobuf/cmd/protoc-gen-go 23 //go:generate protoc --go_out=. --go_opt=paths=source_relative index.proto 24 25 // MarshalJSON implements the json.Marshaler interface for an *Index, by 26 // delegating to the protojson marshaler. This allows a node to be encoded 27 // using the encoding/json package transparently. 28 func (idx *Index) MarshalJSON() ([]byte, error) { return protojson.Marshal(idx) }