NewListStructure returns a new ListStructure It will return a nil ListStructure if the database cannot be opened or the database cannot be created The database will be created if it does not exist
(options config.Options)
| 37 | // or the database cannot be created |
| 38 | // The database will be created if it does not exist |
| 39 | func NewListStructure(options config.Options) (*ListStructure, error) { |
| 40 | db, err := engine.NewDB(options) |
| 41 | if err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | return &ListStructure{db: db}, nil |
| 45 | } |
| 46 | |
| 47 | // LPush adds a value to the left of the list corresponding to the key |
| 48 | // If the key does not exist, it will create the key |