getListWithDefault this function will get list, if list not exists, will create a new one.
(bucket string)
| 109 | // this function will get list, if list not exists, will create |
| 110 | // a new one. |
| 111 | func (tx *Tx) getListWithDefault(bucket string) (*data.List, error) { |
| 112 | b, err := tx.db.bucketMgr.GetBucket(DataStructureList, bucket) |
| 113 | if err != nil { |
| 114 | return nil, err |
| 115 | } |
| 116 | bucketId := b.Id |
| 117 | |
| 118 | // Ensure the list index exists before performing list operations |
| 119 | return tx.db.Index.List.GetWithDefault(bucketId), nil |
| 120 | } |
| 121 | |
| 122 | // RPush inserts the values at the tail of the list stored in the bucket at given bucket,key and values. |
| 123 | func (tx *Tx) RPush(bucket string, key []byte, values ...[]byte) error { |
no test coverage detected