github.com/blend/go-sdk@v1.20220411.3/configutil/strings.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 configutil
     9  
    10  import "context"
    11  
    12  // StringsSource is a type that can return a value.
    13  type StringsSource interface {
    14  	// Strings should return a string array if the source has a given value.
    15  	// It should return nil if the value is not present.
    16  	// It should return an error if there was a problem fetching the value.
    17  	Strings(context.Context) ([]string, error)
    18  }
    19  
    20  var (
    21  	_ StringsSource = (*Strings)(nil)
    22  )
    23  
    24  // Strings implements a value provider.
    25  type Strings []string
    26  
    27  // Strings returns the value for a constant.
    28  func (s Strings) Strings(_ context.Context) ([]string, error) {
    29  	return []string(s), nil
    30  }