1// Copyright 2019 Google LLC
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// TODO: Remove entire file when support for Go1.12 and lower has been dropped.
16// +build go1.13
17
18package spanner
19
20import "errors"
21
22// unwrap is a generic implementation of (errors|xerrors).Unwrap(error). This
23// implementation uses errors and is included in Go 1.13 and later builds.
24func unwrap(err error) error {
25	return errors.Unwrap(err)
26}
27
28// errorAs is a generic implementation of
29// (errors|xerrors).As(error, interface{}). This implementation uses errors and
30// is included in Go 1.13 and later builds.
31func errorAs(err error, target interface{}) bool {
32	return errors.As(err, target)
33}
34