github.com/MetalBlockchain/metalgo@v1.11.9/x/archivedb/value.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package archivedb
     5  
     6  func newDBValue(value []byte) []byte {
     7  	dbValue := make([]byte, len(value)+1)
     8  	copy(dbValue[1:], value)
     9  	return dbValue
    10  }
    11  
    12  func parseDBValue(dbValue []byte) ([]byte, bool) {
    13  	if len(dbValue) == 0 {
    14  		return nil, false
    15  	}
    16  	return dbValue[1:], true
    17  }