github.com/blend/go-sdk@v1.20220411.3/web/result_provider.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package web 9 10 // ResultProvider is the provider interface for results. 11 type ResultProvider interface { 12 InternalError(err error) Result 13 BadRequest(err error) Result 14 NotFound() Result 15 NotAuthorized() Result 16 Status(int, interface{}) Result 17 } 18 19 // ResultOrDefault returns a result or a default. 20 func ResultOrDefault(result, defaultResult interface{}) interface{} { 21 if result != nil { 22 return result 23 } 24 return defaultResult 25 }