mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
57816592ba
not set on the INSERT. - OUT: Only sets the ID on the passed session and returns it. (`CreatedAt`, `AccessedAt`, are not set.) New version: ```go func (ds *Datastore) NewSession(ctx context.Context, userID uint, sessionKey string) (*fleet.Session, error) { sqlStatement := ` INSERT INTO sessions ( user_id, ` + "`key`" + ` ) VALUES(?,?) ` result, err := ds.writer.ExecContext(ctx, sqlStatement, userID, sessionKey) if err != nil { return nil, ctxerr.Wrap(ctx, err, "inserting session") } id, _ := result.LastInsertId() // cannot fail with the mysql driver return ds.sessionByID(ctx, ds.writer, uint(id)) } ``` - IN: Define arguments that are truly used when creating a session. - OUT: Load and return the fleet.Session struct with all values set (using the `ds.writer` to support read replicas correctly). PS: The new `NewSession` version mimics what we already do with other entities, like policies (`Datastore.NewGlobalPolicy`). |
||
---|---|---|
.. | ||
.keep | ||
issue-2814-export-hosts-as-csv | ||
issue-2825-os-versions | ||
issue-3573-remove-enroll-secrets-from-settings-page | ||
issue-4214-vulnerabilities-column | ||
issue-4469-read-replica-non-sso-login | ||
issue-4537-accessibility-through-tabbing | ||
issue-4792-download-tmp | ||
issue-4799-fix-table-headers | ||
issue-4807-fleet-desktop-windows | ||
issue-4846-add-jira-integrations-config |