Compare commits

..

No commits in common. "e5b8457f4284eba25a06bce00bed9e99a7e10c6a" and "b3ebc23b0955df5cd70329e95d2f237fd3176fe3" have entirely different histories.

25 changed files with 81 additions and 77 deletions

View File

@ -1,4 +1,4 @@
![Build Check Runner](https://git.anthrove.art/Anthrove/otter-space-sdk/v4/actions/workflows/build_check.yaml/badge.svg)
![Build Check Runner](https://git.anthrove.art/Anthrove/otter-space-sdk/v3/actions/workflows/build_check.yaml/badge.svg)
[![Bugs](https://sonarqube.dragse.de/api/project_badges/measure?project=Anthrove---OtterSpace-SDK&metric=bugs&token=sqb_96012ffdd64ce721d7f9c82bfa77aa27a5c1fd38)](https://sonarqube.dragse.de/dashboard?id=Anthrove---OtterSpace-SDK)
[![Code Smells](https://sonarqube.dragse.de/api/project_badges/measure?project=Anthrove---OtterSpace-SDK&metric=code_smells&token=sqb_96012ffdd64ce721d7f9c82bfa77aa27a5c1fd38)](https://sonarqube.dragse.de/dashboard?id=Anthrove---OtterSpace-SDK)
[![Coverage](https://sonarqube.dragse.de/api/project_badges/measure?project=Anthrove---OtterSpace-SDK&metric=coverage&token=sqb_96012ffdd64ce721d7f9c82bfa77aa27a5c1fd38)](https://sonarqube.dragse.de/dashboard?id=Anthrove---OtterSpace-SDK)
@ -22,7 +22,7 @@ The OtterSpace SDK is a Go package for interacting with the OtterSpace API. It p
To install the OtterSpace SDK, you can use `go get`:
```shell
go get git.anthrove.art/Anthrove/otter-space-sdk/v4
go get git.anthrove.art/Anthrove/otter-space-sdk/v3
````
## Usage
@ -34,8 +34,8 @@ package main
import (
"context"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/database"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
)
func main() {

2
go.mod
View File

@ -1,4 +1,4 @@
module git.anthrove.art/Anthrove/otter-space-sdk/v4
module git.anthrove.art/Anthrove/otter-space-sdk/v3
go 1.22.0

View File

@ -4,10 +4,11 @@ import (
"context"
"embed"
"fmt"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
migrate "github.com/rubenv/sql-migrate"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/bridges/otellogrus"
@ -17,7 +18,7 @@ import (
"gorm.io/gorm"
)
const tracingName = "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/database"
const tracingName = "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
var (
//go:embed migrations/*.sql
@ -65,6 +66,9 @@ func Connect(ctx context.Context, config models.DatabaseConfig) error {
dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s", config.Endpoint, config.Username, config.Password, config.Database, config.Port, localSSL, config.Timezone)
sqlDB, err := gorm.Open(postgres.Open(dsn), &gorm.Config{
TranslateError: true,
NowFunc: func() time.Time {
return time.Now().UTC()
},
})
if err != nil {
return utils.HandleError(ctx, span, localLogger, err)

View File

@ -4,8 +4,8 @@ import (
"context"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -7,8 +7,8 @@ import (
"testing"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -21,9 +21,9 @@ CREATE TABLE "Post"
(
id CHAR(25) PRIMARY KEY,
rating Rating,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL NULL
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL NULL
);
CREATE TABLE "Source"
@ -32,26 +32,26 @@ CREATE TABLE "Source"
display_name TEXT NULL,
icon TEXT NULL,
domain TEXT NOT NULL UNIQUE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL
);
CREATE TABLE "Tag"
(
name TEXT PRIMARY KEY,
tag_type TagType,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL
);
CREATE TABLE "User"
(
id TEXT PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL
);
CREATE TABLE "PostReference"
@ -70,28 +70,28 @@ CREATE TABLE "TagAlias"
(
name TEXT PRIMARY KEY,
tag_id TEXT REFERENCES "Tag" (name),
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE "TagGroup"
(
name TEXT PRIMARY KEY,
tag_id TEXT REFERENCES "Tag" (name),
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE "UserSource"
(
id CHAR(25) PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL NULL,
user_id TEXT REFERENCES "User" (id),
source_id TEXT REFERENCES "Source" (id),
scrape_time_interval TEXT,
account_username TEXT,
account_id TEXT,
last_scrape_time TIMESTAMP WITH TIME ZONE,
last_scrape_time TIMESTAMP,
account_validate BOOL DEFAULT FALSE,
account_validation_key CHAR(25),
UNIQUE (source_id, account_username, account_id)
@ -100,9 +100,9 @@ CREATE TABLE "UserSource"
CREATE TABLE "UserFavorites"
(
id CHAR(25) PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE NULL NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP NULL NULL,
user_id TEXT REFERENCES "User" (id),
post_id TEXT REFERENCES "Post" (id),
user_source_id CHAR(25) REFERENCES "UserSource" (id)

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -7,8 +7,8 @@ import (
"testing"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -3,7 +3,7 @@ package database
import (
"math"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"gorm.io/gorm"
)

View File

@ -5,8 +5,8 @@ import (
"reflect"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -7,8 +7,8 @@ import (
"testing"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -5,8 +5,8 @@ import (
"reflect"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
)

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -5,8 +5,8 @@ import (
"reflect"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
)

View File

@ -5,8 +5,8 @@ import (
"reflect"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
)

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -4,9 +4,9 @@ import (
"context"
"errors"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
"gorm.io/gorm"

View File

@ -7,8 +7,8 @@ import (
"testing"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
"gorm.io/gorm"

View File

@ -5,8 +5,8 @@ import (
"fmt"
"testing"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/test"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/test"
"go.opentelemetry.io/contrib/bridges/otellogrus"
"go.opentelemetry.io/otel"
)

View File

@ -5,7 +5,7 @@ import (
"math/rand"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
"github.com/davecgh/go-spew/spew"
gonanoid "github.com/matoous/go-nanoid/v2"
"gorm.io/gorm"

View File

@ -8,7 +8,7 @@ import (
"strings"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v4/pkg/models"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
migrate "github.com/rubenv/sql-migrate"
postgrescontainer "github.com/testcontainers/testcontainers-go/modules/postgres"
"gorm.io/driver/postgres"