Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Storage ¶ added in v1.4.0
type Storage interface { // Create creates a new object and put it into the DB Create(r any) error // Save updates the record r (workaround with conds needed that e.g. user has no specific ID, and we can not touch // the generated (gRPC) code s.t. user.username has primary key annotation) Save(r any, conds ...any) error // Update updates the record with given id of the DB with non-zero values in r Update(r any, conds ...any) error // Get gets the record which meet the given conditions Get(r any, conds ...any) error // List lists all records in database which meet the (optionally) given conditions with a certain limit after an // offset. If no limit is desired, the value -1 can be specified. Optionally set orderBy (column) and asc (true = // ascending, false = descending) for ordering the results. // Whitelist the set of possible column names to avoid injections. List(r any, orderBy string, asc bool, offset int, limit int, conds ...any) error // Count counts the number of records which meet the (optionally) given conditions Count(r any, conds ...any) (int64, error) // Delete deletes the record with given id of the DB Delete(r any, conds ...any) error // Raw executes a raw SQL statement and stores the result in r Raw(r any, query string, args ...any) error }
Storage comprises a database interface TODO(all): I think with generics we could get sth. like `[T]Get(r T, id string) T` which is maybe more intuitive then changing the parameter? Maybe its only my impression
Click to show internal directories.
Click to hide internal directories.