repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/attachment_filter_test.go
store/test/attachment_filter_test.go
package test import ( "testing" "time" "github.com/stretchr/testify/require" ) // ============================================================================= // Filename Field Tests // Schema: filename (string, supports contains) // ============================================================================= ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/idp_test.go
store/test/idp_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func TestIdentityProviderStore(t *testing.T) { ctx := context.Background() ts := NewTestingStore(ctx, t) createdIDP, err := ts.CreateIdentit...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/store.go
store/test/store.go
package test import ( "context" "fmt" "net" "os" "testing" // sqlite driver. _ "modernc.org/sqlite" "github.com/joho/godotenv" "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/internal/version" "github.com/usememos/memos/store" "github.com/usememos/memos/store/db" ) // NewTesting...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/containers.go
store/test/containers.go
package test import ( "context" "database/sql" "fmt" "strings" "sync" "sync/atomic" "testing" "time" "github.com/pkg/errors" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/mysql" "github.com/testcontainers/testcontainers-go/modules/postgres" "github.com...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/filter_helpers_test.go
store/test/filter_helpers_test.go
package test import ( "context" "strconv" "testing" "github.com/lithammer/shortuuid/v4" "github.com/stretchr/testify/require" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) // ============================================================================= // Formatting ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/instance_setting_test.go
store/test/instance_setting_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func TestInstanceSettingV1Store(t *testing.T) { ctx := context.Background() ts := NewTestingStore(ctx, t) instanceSetting, err := ts.UpsertI...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/store/test/user_test.go
store/test/user_test.go
package test import ( "context" "fmt" "testing" "github.com/stretchr/testify/require" "golang.org/x/crypto/bcrypt" "github.com/usememos/memos/store" ) func TestUserStore(t *testing.T) { ctx := context.Background() ts := NewTestingStore(ctx, t) user, err := createTestingHostUser(ctx, ts) require.NoError(t,...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/util/util.go
internal/util/util.go
package util //nolint:revive // util namespace is intentional for shared helpers import ( "crypto/rand" "math/big" "net/mail" "strconv" "strings" "github.com/google/uuid" ) // ConvertStringToInt32 converts a string to int32. func ConvertStringToInt32(src string) (int32, error) { parsed, err := strconv.ParseIn...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/util/util_test.go
internal/util/util_test.go
package util //nolint:revive // util is an appropriate package name for utility functions import ( "testing" ) func TestValidateEmail(t *testing.T) { tests := []struct { email string want bool }{ { email: "t@gmail.com", want: true, }, { email: "@usememos.com", want: false, }, { emai...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/base/resource_name_test.go
internal/base/resource_name_test.go
package base import ( "testing" ) func TestUIDMatcher(t *testing.T) { tests := []struct { input string expected bool }{ {"", false}, {"-abc123", false}, {"012345678901234567890123456789", true}, {"1abc-123", true}, {"A123B456C789", true}, {"a", true}, {"ab", true}, {"a*b&c", false}, {"a--b...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/base/resource_name.go
internal/base/resource_name.go
package base import "regexp" var ( UIDMatcher = regexp.MustCompile("^[a-zA-Z0-9]([a-zA-Z0-9-]{0,30}[a-zA-Z0-9])?$") )
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/version/version_test.go
internal/version/version_test.go
package version import ( "sort" "testing" "github.com/stretchr/testify/assert" ) func TestIsVersionGreaterOrEqualThan(t *testing.T) { tests := []struct { version string target string want bool }{ { version: "0.9.1", target: "0.9.1", want: true, }, { version: "0.10.0", target: ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/version/version.go
internal/version/version.go
package version import ( "fmt" "strings" "golang.org/x/mod/semver" ) // Version is the service current released version. // Semantic versioning: https://semver.org/ var Version = "0.26.0" // DevVersion is the service current development version. var DevVersion = "0.26.0" func GetCurrentVersion(mode string) stri...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/internal/profile/profile.go
internal/profile/profile.go
package profile import ( "fmt" "log/slog" "os" "path/filepath" "runtime" "strings" "github.com/pkg/errors" ) // Profile is the configuration to start main server. type Profile struct { // Mode can be "prod" or "dev" or "demo" Mode string // Addr is the binding address for server Addr string // Port is th...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/server.go
server/server.go
package server import ( "context" "fmt" "log/slog" "net" "net/http" "runtime" "time" "github.com/google/uuid" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/pkg/errors" "github.com/usememos/memos/internal/profile" storepb "github.com/usememos/memos/proto/gen/store" a...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/auth/token_test.go
server/auth/token_test.go
package auth import ( "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestGenerateAccessTokenV2(t *testing.T) { secret := []byte("test-secret") t.Run("generates valid access token", func(t *testing.T) { token, expiresAt, err := GenerateAccessTokenV2(1, "tes...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/auth/token.go
server/auth/token.go
// Package auth provides authentication and authorization for the Memos server. // // This package is used by: // - server/router/api/v1: gRPC and Connect API interceptors // - server/router/fileserver: HTTP file server authentication // // Authentication methods supported: // - JWT access tokens: Short-lived tokens (1...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/auth/authenticator.go
server/auth/authenticator.go
package auth import ( "context" "log/slog" "strings" "time" "github.com/pkg/errors" "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/internal/util" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) // Authenticator provides shared authent...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/auth/extract.go
server/auth/extract.go
package auth import ( "net/http" "strings" ) // ExtractBearerToken extracts the JWT token from an Authorization header value. // Expected format: "Bearer {token}" // Returns empty string if no valid bearer token is found. func ExtractBearerToken(authHeader string) string { if authHeader == "" { return "" } par...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/auth/context.go
server/auth/context.go
package auth import ( "context" "github.com/usememos/memos/store" ) // ContextKey is the key type for context values. // Using a custom type prevents collisions with other packages. type ContextKey int const ( // UserIDContextKey stores the authenticated user's ID. // Set for all authenticated requests. // Use...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/runner/memopayload/runner.go
server/runner/memopayload/runner.go
package memopayload import ( "context" "log/slog" "github.com/pkg/errors" "github.com/usememos/memos/plugin/markdown" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) type Runner struct { Store *store.Store MarkdownService markdown.Service } func NewRunner(s...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/runner/s3presign/runner.go
server/runner/s3presign/runner.go
package s3presign import ( "context" "log/slog" "time" "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/plugin/storage/s3" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) type Runner struct { Store *store.Store } func NewRunner(store *s...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/rss/rss.go
server/router/rss/rss.go
package rss import ( "context" "crypto/sha256" "fmt" "net/http" "regexp" "strconv" "strings" "sync" "time" "github.com/gorilla/feeds" "github.com/labstack/echo/v4" "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/plugin/markdown" storepb "github.com/usememos/memos/proto/gen/store...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/connect_services.go
server/router/api/v1/connect_services.go
package v1 import ( "context" "connectrpc.com/connect" "google.golang.org/protobuf/types/known/emptypb" v1pb "github.com/usememos/memos/proto/gen/api/v1" ) // This file contains all Connect service handler method implementations. // Each method delegates to the underlying gRPC service implementation, // convert...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/memo_service_converter.go
server/router/api/v1/memo_service_converter.go
package v1 import ( "context" "fmt" "time" "github.com/pkg/errors" "google.golang.org/protobuf/types/known/timestamppb" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func (s *APIV1Service) convertMemoFromStore(ctx co...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/auth_service.go
server/router/api/v1/auth_service.go
package v1 import ( "context" "fmt" "log/slog" "regexp" "strings" "time" "github.com/pkg/errors" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/memo_attachment_service.go
server/router/api/v1/memo_attachment_service.go
package v1 import ( "context" "slices" "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" v1pb "github.com/usememos/memos/proto/gen/api/v1" "github.com/usememos/memos/store" ) func (s *APIV1Service) SetMemoAttachments(ctx context.Context, r...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/memo_service.go
server/router/api/v1/memo_service.go
package v1 import ( "context" "fmt" "log/slog" "strings" "time" "github.com/lithammer/shortuuid/v4" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "github.com/usememos/memos/internal/base" "github.com/usememos/memos/...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/acl_config.go
server/router/api/v1/acl_config.go
package v1 // PublicMethods defines API endpoints that don't require authentication. // All other endpoints require a valid session or access token. // // This is the SINGLE SOURCE OF TRUTH for public endpoints. // Both Connect interceptor and gRPC-Gateway interceptor use this map. // // Format: Full gRPC procedure pa...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/idp_service.go
server/router/api/v1/idp_service.go
package v1 import ( "context" "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func (s *APIV1Service)...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/connect_interceptors.go
server/router/api/v1/connect_interceptors.go
package v1 import ( "context" "errors" "fmt" "log/slog" "runtime/debug" "connectrpc.com/connect" pkgerrors "github.com/pkg/errors" "google.golang.org/grpc/metadata" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) // MetadataInterceptor converts Connect HTTP headers to gRPC meta...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/attachment_service.go
server/router/api/v1/attachment_service.go
package v1 import ( "bytes" "context" "encoding/binary" "fmt" "io" "mime" "net/http" "os" "path/filepath" "regexp" "strings" "time" "github.com/lithammer/shortuuid/v4" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptyp...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/reaction_service.go
server/router/api/v1/reaction_service.go
package v1 import ( "context" "fmt" "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/timestamppb" v1pb "github.com/usememos/memos/proto/gen/api/v1" "github.com/usememos/memos/store" ) func (s *APIV...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/shortcut_service.go
server/router/api/v1/shortcut_service.go
package v1 import ( "context" "fmt" "strings" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "github.com/usememos/memos/internal/util" "github.com/usememos/memos/plugin/filter" v1pb "github.com/usememos/memos/proto/gen...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/resource_name.go
server/router/api/v1/resource_name.go
package v1 import ( "fmt" "strings" "github.com/pkg/errors" "github.com/usememos/memos/internal/util" ) const ( InstanceSettingNamePrefix = "instance/settings/" UserNamePrefix = "users/" MemoNamePrefix = "memos/" AttachmentNamePrefix = "attachments/" ReactionNamePrefix ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/memo_service_filter.go
server/router/api/v1/memo_service_filter.go
package v1
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/user_service.go
server/router/api/v1/user_service.go
package v1 import ( "context" "crypto/rand" "encoding/hex" "fmt" "net/http" "regexp" "strconv" "strings" "time" "github.com/google/cel-go/cel" "github.com/google/cel-go/common/ast" "github.com/labstack/echo/v4" "github.com/pkg/errors" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/codes" "google...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
true
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/health_service.go
server/router/api/v1/health_service.go
package v1 import ( "context" "google.golang.org/grpc/codes" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/status" ) func (s *APIV1Service) Check(ctx context.Context, _ *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) { // Check if database is initialize...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/user_service_stats.go
server/router/api/v1/user_service_stats.go
package v1 import ( "context" "fmt" "time" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" v1pb "github.com/usememos/memos/proto/gen/api/v1" "github.com/usememos/memos/store" ) func (s *APIV1Service) ListAllUserStat...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/acl_config_test.go
server/router/api/v1/acl_config_test.go
package v1 import ( "testing" "github.com/stretchr/testify/assert" ) // TestPublicMethodsArePublic verifies that methods in PublicMethods are recognized as public. func TestPublicMethodsArePublic(t *testing.T) { publicMethods := []string{ // Auth Service "/memos.api.v1.AuthService/SignIn", "/memos.api.v1.Au...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/header_carrier.go
server/router/api/v1/header_carrier.go
package v1 import ( "context" "connectrpc.com/connect" "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) // headerCarrierKey is the context key for storing headers to be set in the response. type headerCarrierKey struct{} // HeaderCarrier stores headers that need to be set in the response. // // Prob...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/instance_service.go
server/router/api/v1/instance_service.go
package v1 import ( "context" "fmt" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) // GetInstanceProfile returns the instance prof...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/auth_service_client_info_test.go
server/router/api/v1/auth_service_client_info_test.go
package v1 import ( "context" "testing" "google.golang.org/grpc/metadata" storepb "github.com/usememos/memos/proto/gen/store" ) func TestParseUserAgent(t *testing.T) { service := &APIV1Service{} tests := []struct { name string userAgent string expectedDevice string expectedOS s...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/activity_service.go
server/router/api/v1/activity_service.go
package v1 import ( "context" "fmt" "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func (s *A...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/connect_handler.go
server/router/api/v1/connect_handler.go
package v1 import ( "net/http" "connectrpc.com/connect" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/usememos/memos/proto/gen/api/v1/apiv1connect" ) // ConnectServiceHandler wraps APIV1Service to implement Connect handler interfaces. // It adapts the existing gRPC service implemen...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/memo_relation_service.go
server/router/api/v1/memo_relation_service.go
package v1 import ( "context" "fmt" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" v1pb "github.com/usememos/memos/proto/gen/api/v1" "github.com/usememos/memos/store" ) func (s *APIV1Service) SetMemoRelations(ctx contex...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/v1.go
server/router/api/v1/v1.go
package v1 import ( "context" "net/http" "connectrpc.com/connect" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "golang.org/x/sync/semaphore" "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/plugin/markdown" ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/common.go
server/router/api/v1/common.go
package v1 import ( "encoding/base64" "github.com/pkg/errors" "google.golang.org/protobuf/proto" v1pb "github.com/usememos/memos/proto/gen/api/v1" "github.com/usememos/memos/store" ) const ( // DefaultPageSize is the default page size for requests. DefaultPageSize = 10 // MaxPageSize is the maximum page siz...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/idp_service_test.go
server/router/api/v1/test/idp_service_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" v1pb "github.com/usememos/memos/proto/gen/api/v1" ) func TestCreateIdentityProvider(t *testing.T) { ctx := context.Background() t.Run("CreateIdentityProvider success", func(t ...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/memo_relation_service_test.go
server/router/api/v1/test/memo_relation_service_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/proto/gen/api/v1" ) func TestSetMemoRelations(t *testing.T) { ctx := context.Background() t.Run("SetMemoRelations success by memo owner", func(t *testing.T) { ts := NewTestService(t) defer ts....
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/reaction_service_test.go
server/router/api/v1/test/reaction_service_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/proto/gen/api/v1" ) func TestDeleteMemoReaction(t *testing.T) { ctx := context.Background() t.Run("DeleteMemoReaction success by reaction owner", func(t *testing.T) { ts := NewTestService(t) d...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/attachment_service_test.go
server/router/api/v1/test/attachment_service_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" v1pb "github.com/usememos/memos/proto/gen/api/v1" ) func TestCreateAttachment(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() ctx := context.Background() user, err := ts.CreateRegularUser(ctx, "test_user") require.N...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/memo_service_test.go
server/router/api/v1/test/memo_service_test.go
package test import ( "context" "fmt" "slices" "testing" "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/proto/gen/api/v1" ) func TestListMemos(t *testing.T) { ctx := context.Background() ts := NewTestService(t) defer ts.Cleanup() // Create userOne userOne, err := ts.CreateRegula...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/memo_attachment_service_test.go
server/router/api/v1/test/memo_attachment_service_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/proto/gen/api/v1" ) func TestSetMemoAttachments(t *testing.T) { ctx := context.Background() t.Run("SetMemoAttachments success by memo owner", func(t *testing.T) { ts := NewTestService(t) defer...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/user_service_registration_test.go
server/router/api/v1/test/user_service_registration_test.go
package test import ( "context" "testing" "github.com/stretchr/testify/require" apiv1 "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" ) func TestCreateUserRegistration(t *testing.T) { ctx := context.Background() t.Run("CreateUser success when registration ena...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/shortcut_service_test.go
server/router/api/v1/test/shortcut_service_test.go
package test import ( "context" "fmt" "testing" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" v1pb "github.com/usememos/memos/proto/gen/api/v1" ) func TestListShortcuts(t *testing.T) { ctx := context.Background() t.Run("ListShortcuts success", func(t *testing.T)...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/instance_service_test.go
server/router/api/v1/test/instance_service_test.go
package test import ( "context" "fmt" "testing" "github.com/stretchr/testify/require" v1pb "github.com/usememos/memos/proto/gen/api/v1" ) func TestGetInstanceProfile(t *testing.T) { ctx := context.Background() t.Run("GetInstanceProfile returns instance profile", func(t *testing.T) { // Create test service...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/test_helper.go
server/router/api/v1/test/test_helper.go
package test import ( "context" "testing" "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/plugin/markdown" "github.com/usememos/memos/server/auth" apiv1 "github.com/usememos/memos/server/router/api/v1" "github.com/usememos/memos/store" teststore "github.com/usememos/memos/store/test" )...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/user_service_stats_test.go
server/router/api/v1/test/user_service_stats_test.go
package test import ( "context" "fmt" "testing" "github.com/stretchr/testify/require" v1pb "github.com/usememos/memos/proto/gen/api/v1" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) func TestGetUserStats_TagCount(t *testing.T) { ctx := context.Background() // Crea...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/api/v1/test/auth_test.go
server/router/api/v1/test/auth_test.go
package test import ( "context" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/internal/util" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/aut...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/fileserver/fileserver.go
server/router/fileserver/fileserver.go
package fileserver import ( "bytes" "context" "encoding/base64" "fmt" "io" "net/http" "os" "path/filepath" "regexp" "strings" "time" "github.com/disintegration/imaging" "github.com/labstack/echo/v4" "github.com/pkg/errors" "golang.org/x/sync/semaphore" "github.com/usememos/memos/internal/profile" "g...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
usememos/memos
https://github.com/usememos/memos/blob/e75862de31b65f90007d771fd623e1d23261b2c6/server/router/frontend/frontend.go
server/router/frontend/frontend.go
package frontend import ( "context" "embed" "io/fs" "net/http" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/internal/util" "github.com/usememos/memos/store" ) //go:embed dist/* var embeddedFiles embed.FS type...
go
MIT
e75862de31b65f90007d771fd623e1d23261b2c6
2026-01-07T08:35:43.552360Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/nvm.go
src/nvm.go
package main import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "net/url" "os" "os/exec" "os/signal" "os/user" "path/filepath" "regexp" "strconv" "strings" "sync" "syscall" "time" "unsafe" "nvm/arch" "nvm/author" "nvm/encoding" "nvm/file" "nvm/node" "nvm/upgrade" "nvm/utility" "nvm/...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
true
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/encoding/encoding.go
src/encoding/encoding.go
package encoding import ( "strings" "unicode/utf8" "github.com/saintfish/chardet" ) func DetectCharset(content []byte) (string, error) { detector := chardet.NewTextDetector() result, err := detector.DetectBest(content) if err != nil { return "", err } return strings.ToUpper(result.Charset), nil } func To...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/upgrade/register.go
src/upgrade/register.go
package upgrade import ( "fmt" "os" "os/exec" "path/filepath" "strings" ) const ( NODE_LTS_SCHEDULE_NAME = "NVM for Windows Node.js LTS Update Check" NODE_CURRENT_SCHEDULE_NAME = "NVM for Windows Node.js Current Update Check" NVM4W_SCHEDULE_NAME = "NVM for Windows Update Check" AUTHOR_SCHEDULE_NAM...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/upgrade/check.go
src/upgrade/check.go
package upgrade import ( "encoding/json" "fmt" "nvm/node" "nvm/semver" "nvm/web" "os" "path/filepath" "strings" "time" "github.com/dustin/go-humanize" "github.com/go-toast/toast" ) func Check(root string, nvmversion string) { // Store the recognized version to prevent duplicates notices := LoadNotices()...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/upgrade/notification.go
src/upgrade/notification.go
package upgrade import ( "encoding/json" "os" "path/filepath" "time" ) type LastNotification struct { outpath string LTS string `json:"lts,omitempty"` Current string `json:"current,omitempty"` NVM4W string `json:"nvm4w,omitempty"` Author string `json:"author,omitempty"` } func LoadNotices() *LastNoti...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/upgrade/upgrade.go
src/upgrade/upgrade.go
package upgrade import ( "archive/zip" "crypto/md5" "encoding/json" "fmt" "io" "net/http" "nvm/author" "nvm/semver" "nvm/utility" "os" "os/exec" "os/signal" "path/filepath" "strings" "sync" "syscall" "time" "unsafe" "github.com/coreybutler/go-fsutil" "github.com/ncruces/zenity" "golang.org/x/sys/...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/file/file.go
src/file/file.go
package file import ( "archive/zip" "bufio" "io" "log" "os" "path/filepath" "strings" ) // Function courtesy http://stackoverflow.com/users/1129149/swtdrgn func Unzip(src, dest string) error { r, err := zip.OpenReader(src) if err != nil { return err } defer r.Close() for _, f := range r.File { if !st...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/node/node.go
src/node/node.go
package node import ( "encoding/json" "fmt" "io/ioutil" "nvm/arch" "nvm/file" "nvm/web" "os" "os/exec" "regexp" "strings" // "../semver" "github.com/blang/semver" ) /** * Returns version, architecture */ func GetCurrentVersion() (string, string) { cmd := exec.Command("node", "-v") str, err := cmd.Out...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/author/bridge.go
src/author/bridge.go
package author import ( "bufio" "fmt" "os" "os/exec" "path/filepath" "strings" "syscall" "time" "github.com/coreybutler/go-fsutil" "golang.org/x/sys/windows" ) const ( // Constants for SetWindowPos SWP_NOMOVE = 0x0002 SWP_NOZORDER = 0x0004 SWP_SHOWWINDOW = 0x0040 SW_HIDE = 0 // Hide the w...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/arch/arch.go
src/arch/arch.go
package arch import ( //"regexp" "os" //"os/exec" "strings" //"fmt" "encoding/hex" ) func SearchBytesInFile( path string, match string, limit int) bool { // Transform to byte array the string toMatch, err := hex.DecodeString(match); if (err != nil) { return false; } // Opening the file and chec...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/semver/semver.go
src/semver/semver.go
/** * Used under the MIT License. * Semver courtesy Benedikt Lang (https://github.com/blang) */ package semver import ( "errors" "fmt" "strconv" "strings" ) const ( numbers string = "0123456789" alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" alphanum = alphas + numbers do...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/web/web.go
src/web/web.go
package web import ( "crypto/tls" "fmt" "io" "io/ioutil" "net" "net/http" "net/url" "nvm/arch" "nvm/file" "os" "os/exec" "os/signal" "path/filepath" "strconv" "strings" "syscall" "nvm/utility" "archive/zip" "github.com/blang/semver" fs "github.com/coreybutler/go-fsutil" ) var nvmversion = "" va...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/utility/logging.go
src/utility/logging.go
package utility import ( "fmt" "os" "path/filepath" "runtime" "strings" "syscall" ) var debug bool = false var exe string var path string const ( // Enable virtual terminal processing on Windows (required to interpret ANSI escape codes) enableVirtualTerminalProcessing = 0x0004 BOLD ...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/blob/883c0dea378ba991c7dc38ea5a39e6d5fc56453f/src/utility/rename.go
src/utility/rename.go
package utility import ( "fmt" "io" "os" "path/filepath" ) func Rename(old, new string) error { old_drive := filepath.VolumeName(old) new_drive := filepath.VolumeName(new) if old_drive == new_drive { return os.Rename(old, new) } // Get file or directory info info, err := os.Stat(old) if err != nil { ...
go
MIT
883c0dea378ba991c7dc38ea5a39e6d5fc56453f
2026-01-07T08:35:46.109469Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/statement.go
statement.go
package gorm import ( "context" "database/sql" "database/sql/driver" "fmt" "reflect" "regexp" "sort" "strconv" "strings" "sync" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // Statement statement type Statement struct { *DB TableExpr *clause.Expr...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/interfaces.go
interfaces.go
package gorm import ( "context" "database/sql" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) // Dialector GORM database dialector type Dialector interface { Name() string Initialize(*DB) error Migrator(db *DB) Migrator DataTypeOf(*schema.Field) string DefaultValueOf(*schema.Field) clause.Expression BindVar...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/soft_delete.go
soft_delete.go
package gorm import ( "database/sql" "database/sql/driver" "encoding/json" "reflect" "github.com/jinzhu/now" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) type DeletedAt sql.NullTime // Scan implements the Scanner interface. func (n *DeletedAt) Scan(value interface{}) error { return (*sql.NullTime)(n).Scan(...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/errors.go
errors.go
package gorm import ( "errors" "gorm.io/gorm/logger" ) var ( // ErrRecordNotFound record not found error ErrRecordNotFound = logger.ErrRecordNotFound // ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = errors.New("invalid transaction") // ErrNotIm...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/scan.go
scan.go
package gorm import ( "database/sql" "database/sql/driver" "reflect" "strings" "time" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // prepareValues prepare values slice func prepareValues(values []interface{}, db *DB, columnTypes []*sql.ColumnType, columns []string) { if db.Statement.Schema != nil { for id...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/model.go
model.go
package gorm import "time" // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt // It may be embedded into your model or you may build your own model without it // // type User struct { // gorm.Model // } type Model struct { ID uint `gorm:"primarykey"` Cre...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/finisher_api.go
finisher_api.go
package gorm import ( "context" "database/sql" "errors" "fmt" "hash/maphash" "reflect" "strings" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // Create inserts value, returning the inserted data's primary key in value's id func (db *DB) Create(value interface{})...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/migrator.go
migrator.go
package gorm import ( "reflect" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) // Migrator returns migrator func (db *DB) Migrator() Migrator { tx := db.getInstance() // apply scopes to migrator for len(tx.Statement.scopes) > 0 { tx = tx.executeScopes() } return tx.Dialector.Migrator(tx.Session(&Session{}...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/association.go
association.go
package gorm import ( "fmt" "reflect" "strings" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // Association Mode contains some helper methods to handle relationship things easily. type Association struct { DB *DB Relationship *schema.Relationship Unscope bool Error ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/prepare_stmt.go
prepare_stmt.go
package gorm import ( "context" "database/sql" "database/sql/driver" "errors" "reflect" "sync" "time" "gorm.io/gorm/internal/stmt_store" ) type PreparedStmtDB struct { Stmts stmt_store.Store Mux *sync.RWMutex ConnPool } // NewPreparedStmtDB creates and initializes a new instance of PreparedStmtDB. // /...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/generics.go
generics.go
package gorm import ( "context" "database/sql" "errors" "fmt" "reflect" "sort" "strings" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" ) type result struct { Result sql.Result RowsAffected int64 } func (info *result) ModifyStatement(stmt *Statement) { stmt.Result = info } // ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/chainable_api.go
chainable_api.go
package gorm import ( "fmt" "regexp" "strings" "gorm.io/gorm/clause" "gorm.io/gorm/utils" ) // Model specify the model you would like to run db operations // // // update all users's name to `hello` // db.Model(&User{}).Update("name", "hello") // // if user's primary key is non-blank, will use it as condition, ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/callbacks.go
callbacks.go
package gorm import ( "context" "errors" "fmt" "reflect" "sort" "time" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) func initializeCallbacks(db *DB) *callbacks { return &callbacks{ processors: map[string]*processor{ "create": {db: db}, "query": {db: db}, "update": {db: db}, "delete": {db: db}...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/gorm.go
gorm.go
package gorm import ( "context" "database/sql" "fmt" "reflect" "sort" "sync" "time" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" ) // for Config.cacheStore store PreparedStmtDB key const preparedStmtDBKey = "preparedStmt" // Config GORM config type Config struct { // GORM perform sin...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/statement_test.go
statement_test.go
package gorm import ( "fmt" "reflect" "testing" "gorm.io/gorm/clause" ) func TestWhereCloneCorruption(t *testing.T) { for whereCount := 1; whereCount <= 8; whereCount++ { t.Run(fmt.Sprintf("w=%d", whereCount), func(t *testing.T) { s := new(Statement) for w := 0; w < whereCount; w++ { s = s.clone() ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/migrator/index.go
migrator/index.go
package migrator import "database/sql" // Index implements gorm.Index interface type Index struct { TableName string NameValue string ColumnList []string PrimaryKeyValue sql.NullBool UniqueValue sql.NullBool OptionValue string } // Table return the table name of the index. func (idx In...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/migrator/table_type.go
migrator/table_type.go
package migrator import ( "database/sql" ) // TableType table type implements TableType interface type TableType struct { SchemaValue string NameValue string TypeValue string CommentValue sql.NullString } // Schema returns the schema of the table. func (ct TableType) Schema() string { return ct.SchemaVa...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/migrator/migrator.go
migrator/migrator.go
package migrator import ( "context" "database/sql" "errors" "fmt" "reflect" "regexp" "strconv" "strings" "time" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" ) // This regular expression seeks to find a sequence of digits (\d+) among zero or more non-digit characters (...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/migrator/column_type.go
migrator/column_type.go
package migrator import ( "database/sql" "reflect" ) // ColumnType column type implements ColumnType interface type ColumnType struct { SQLColumnType *sql.ColumnType NameValue sql.NullString DataTypeValue sql.NullString ColumnTypeValue sql.NullString PrimaryKeyValue sql.NullBool Uniqu...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/clause/clause_test.go
clause/clause_test.go
package clause_test import ( "reflect" "strings" "sync" "testing" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gorm/utils/tests" ) var db, _ = gorm.Open(tests.DummyDialector{}, nil) func checkBuildClauses(t *testing.T, clauses []clause.Interface, result string, vars []interface{}) { ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/clause/from.go
clause/from.go
package clause // From from clause type From struct { Tables []Table Joins []Join } // Name from clause name func (from From) Name() string { return "FROM" } // Build build from clause func (from From) Build(builder Builder) { if len(from.Tables) > 0 { for idx, table := range from.Tables { if idx > 0 { ...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/clause/expression_test.go
clause/expression_test.go
package clause_test import ( "database/sql" "fmt" "reflect" "sync" "testing" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gorm/utils/tests" ) func TestExpr(t *testing.T) { results := []struct { SQL string Result string Vars []interface{} }{{ SQL: "create table ? (? ?...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/clause/limit_test.go
clause/limit_test.go
package clause_test import ( "fmt" "testing" "gorm.io/gorm/clause" ) func TestLimit(t *testing.T) { limit0 := 0 limit10 := 10 limit50 := 50 limitNeg10 := -10 results := []struct { Clauses []clause.Interface Result string Vars []interface{} }{ { []clause.Interface{clause.Select{}, clause.From{...
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false
go-gorm/gorm
https://github.com/go-gorm/gorm/blob/0d9141bad9772c6047ecfdb2819d8a52d27ceb65/clause/with.go
clause/with.go
package clause type With struct{}
go
MIT
0d9141bad9772c6047ecfdb2819d8a52d27ceb65
2026-01-07T08:35:52.485253Z
false