func ValidateConditions(resource Resource, r *http.Request) bool {
	if d, err := time.Parse(rfc1123, r.Header.Get("If-Unmodified-Since")); err == nil {
		if d.Sub(resource.LastModified()) < 0 {
			return true
		}
	}
	if etag := r.Header.Get("If-Match"); etag != "" && etag != resource.ETag() {
		return true
	}
	return false
}
/*
ValidateConditions returns true if the If-Unmodified-Since or the If-Match headers of
r are not matching with the current version of resource.

func (ep *endpoint) Patch(vars RouteVars, r *http.Request) (Resource, error) {
resource := db.Lookup(vars.Get("id"))
if ValidateConditions(resource, r) {
return nil, Conflict()
}

apply the patch safely from here
}
package rst
import (
	"net/http"
	"strings"
	"time"
)
var noContent = []byte{}
type Resource interface {
	ETag() string             
	LastModified() time.Time  
	TTL() time.Duration       
}