github.com/blend/go-sdk@v1.20220411.3/testutil/opt_with_label_required.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 testutil
     9  
    10  import (
    11  	"context"
    12  
    13  	"github.com/blend/go-sdk/db"
    14  )
    15  
    16  // OptWithStatementLabelRequired adds a defaultdb interceptor that enforces
    17  // that statement labels must be present on all statements.
    18  func OptWithStatementLabelRequired() Option {
    19  	return func(s *Suite) {
    20  		s.Before = append(s.Before, func(ctx context.Context) error {
    21  			_defaultDB.StatementInterceptor = db.StatementInterceptorChain(
    22  				_defaultDB.StatementInterceptor,
    23  				db.LabelRequiredStatementInterceptor,
    24  			)
    25  			return nil
    26  		})
    27  	}
    28  }