Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: remove random field
johnnyjoy54a48b58d70e
diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.goindex 271fe0c9d..caca7554a 100644--- a/store/db/mysql/memo.go+++ b/store/db/mysql/memo.go@@ -145,10 +145,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memoorders = append(orders, "`created_ts` "+order)}orders = append(orders, "`id` "+order)- if find.Random {- orders = append(orders, "RAND()")- }-fields := []string{"`memo`.`id` AS `id`","`memo`.`uid` AS `uid`",diff --git a/store/db/mysql/user.go b/store/db/mysql/user.goindex 1f9c4cf62..9bf2d9640 100644--- a/store/db/mysql/user.go+++ b/store/db/mysql/user.go@@ -3,7 +3,6 @@ package mysqlimport ("context""fmt"- "slices""strings""github.com/pkg/errors"@@ -99,10 +98,6 @@ func (d *DB) ListUsers(ctx context.Context, find *store.FindUser) ([]*store.User}orderBy := []string{"`created_ts` DESC", "`row_status` DESC"}- if find.Random {- orderBy = slices.Concat([]string{"RAND()"}, orderBy)- }-query := "SELECT `id`, `username`, `role`, `email`, `nickname`, `password_hash`, `avatar_url`, `description`, UNIX_TIMESTAMP(`created_ts`), UNIX_TIMESTAMP(`updated_ts`), `row_status` FROM `user` WHERE " + strings.Join(where, " AND ") + " ORDER BY " + strings.Join(orderBy, ", ")if v := find.Limit; v != nil {query += fmt.Sprintf(" LIMIT %d", *v)diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.goindex 104c8a04c..4dbb399d9 100644--- a/store/db/postgres/memo.go+++ b/store/db/postgres/memo.go@@ -137,10 +137,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memoorders = append(orders, "created_ts "+order)}orders = append(orders, "id "+order)- if find.Random {- orders = append(orders, "RAND()")- }-fields := []string{`memo.id AS id`,`memo.uid AS uid`,diff --git a/store/db/postgres/user.go b/store/db/postgres/user.goindex 13e2890c7..2bdf6f16b 100644--- a/store/db/postgres/user.go+++ b/store/db/postgres/user.go@@ -3,7 +3,6 @@ package postgresimport ("context""fmt"- "slices""strings""github.com/usememos/memos/store"@@ -101,10 +100,6 @@ func (d *DB) ListUsers(ctx context.Context, find *store.FindUser) ([]*store.User}orderBy := []string{"created_ts DESC", "row_status DESC"}- if find.Random {- orderBy = slices.Concat([]string{"RANDOM()"}, orderBy)- }-query := `SELECTid,diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.goindex a66d7c00c..a40a4890f 100644--- a/store/db/sqlite/memo.go+++ b/store/db/sqlite/memo.go@@ -137,10 +137,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.MemoorderBy = append(orderBy, "`created_ts` "+order)}orderBy = append(orderBy, "`id` "+order)- if find.Random {- orderBy = []string{"RANDOM()"}- }-fields := []string{"`memo`.`id` AS `id`","`memo`.`uid` AS `uid`",diff --git a/store/db/sqlite/user.go b/store/db/sqlite/user.goindex 7efb690e4..6c885fd7d 100644--- a/store/db/sqlite/user.go+++ b/store/db/sqlite/user.go@@ -3,7 +3,6 @@ package sqliteimport ("context""fmt"- "slices""strings""github.com/usememos/memos/store"@@ -102,10 +101,6 @@ func (d *DB) ListUsers(ctx context.Context, find *store.FindUser) ([]*store.User}orderBy := []string{"created_ts DESC", "row_status DESC"}- if find.Random {- orderBy = slices.Concat([]string{"RANDOM()"}, orderBy)- }-query := `SELECTid,diff --git a/store/memo.go b/store/memo.goindex 58172fa21..79ed72c8d 100644--- a/store/memo.go+++ b/store/memo.go@@ -73,7 +73,6 @@ type FindMemo struct {PayloadFind *FindMemoPayloadExcludeContent boolExcludeComments bool- Random boolFilter *string// Paginationdiff --git a/store/user.go b/store/user.goindex e61d876ee..8b5c0fd31 100644--- a/store/user.go+++ b/store/user.go@@ -83,9 +83,6 @@ type FindUser struct {Email *stringNickname *string- // Random and limit are used in list users.- // Whether to return random users.- Random bool// The maximum number of users to return.Limit *int}