Source File
equals.go
Belonging Package
github.com/yosida95/uritemplate/v3
// Copyright (C) 2016 Kohei YOSHIDA. All rights reserved.//// This program is free software; you can redistribute it and/or// modify it under the terms of The BSD 3-Clause License// that can be found in the LICENSE file.package uritemplatetype CompareFlags uint8const (CompareVarname CompareFlags = 1 << iota)// Equals reports whether or not two URI Templates t1 and t2 are equivalent.func ( *Template, *Template, CompareFlags) bool {if len(.exprs) != len(.exprs) {return false}for := 0; < len(.exprs); ++ {switch t1 := .exprs[].(type) {case literals:, := .exprs[].(literals)if ! {return false}if != {return false}case *expression:, := .exprs[].(*expression)if ! {return false}if .op != .op || len(.vars) != len(.vars) {return false}for := 0; < len(.vars); ++ {:= .vars[]:= .vars[]if &CompareVarname == CompareVarname && .name != .name {return false}if .maxlen != .maxlen || .explode != .explode {return false}}default:panic("unhandled case")}}return true}
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |