github.com/go-spatial/go-wfs@v0.1.4-0.20190401000911-c9fba2bb5188/wfs3/conformance.go (about)

     1  ///////////////////////////////////////////////////////////////////////////////
     2  //
     3  // The MIT License (MIT)
     4  // Copyright (c) 2018 Jivan Amara
     5  // Copyright (c) 2019 Tom Kralidis
     6  //
     7  // Permission is hereby granted, free of charge, to any person obtaining a copy
     8  // of this software and associated documentation files (the "Software"), to
     9  // deal in the Software without restriction, including without limitation the
    10  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    11  // sell copies of the Software, and to permit persons to whom the Software is
    12  // furnished to do so, subject to the following conditions:
    13  //
    14  // The above copyright notice and this permission notice shall be included in
    15  // all copies or substantial portions of the Software.
    16  //
    17  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    18  // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    19  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    20  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
    21  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
    22  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
    23  // USE OR OTHER DEALINGS IN THE SOFTWARE.
    24  //
    25  ///////////////////////////////////////////////////////////////////////////////
    26  
    27  // jivan project conformance.go
    28  
    29  package wfs3
    30  
    31  import (
    32  	"encoding/json"
    33  	"fmt"
    34  	"hash/fnv"
    35  	"log"
    36  )
    37  
    38  // --- Implements req/core/conformance-op
    39  func Conformance() (content *ConformanceClasses, contentId string) {
    40  	hasher := fnv.New64()
    41  	content = &ConformanceClasses{
    42  		ConformsTo: []string{
    43  			"http://www.opengis.net/spec/wfs-1/3.0/req/core",
    44  			"http://www.opengis.net/spec/wfs-1/3.0/req/geojson",
    45  			"http://www.opengis.net/spec/wfs-1/3.0/req/html",
    46  		},
    47  	}
    48  
    49  	byteContent, err := json.Marshal(content)
    50  	if err != nil {
    51  		log.Printf("Problem marshaling content inside Conformance(): %v", err)
    52  		return nil, ""
    53  	}
    54  
    55  	hasher.Write(byteContent)
    56  	contentId = fmt.Sprintf("%x", hasher.Sum64())
    57  
    58  	return content, contentId
    59  }