github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/kit/sqlx/scanner/nullable/null_ignore_scanner.go (about)

     1  package nullable
     2  
     3  import (
     4  	"database/sql"
     5  	_ "unsafe"
     6  )
     7  
     8  type NullIgnoreScanner struct{ dst interface{} }
     9  
    10  func NewNullIgnoreScanner(dst interface{}) *NullIgnoreScanner {
    11  	return &NullIgnoreScanner{dst: dst}
    12  }
    13  
    14  func (s *NullIgnoreScanner) Scan(src interface{}) error {
    15  	if s, ok := s.dst.(sql.Scanner); ok {
    16  		return s.Scan(src)
    17  	}
    18  	if src == nil {
    19  		return nil
    20  	}
    21  	return convertAssign(s.dst, src)
    22  }
    23  
    24  //go:linkname convertAssign database/sql.convertAssign
    25  func convertAssign(dst, src interface{}) error