gofr-dev/gofr

View on GitHub
examples/using-subscriber/migrations/1721800255_create_topics.go

Summary

Maintainability
A
0 mins
Test Coverage
C
75%
package migrations

import (
    "context"

    "gofr.dev/pkg/gofr/migration"
)

func createTopics() migration.Migrate {
    return migration.Migrate{
        UP: func(d migration.Datasource) error {
            err := d.PubSub.CreateTopic(context.Background(), "products")
            if err != nil {
                return err
            }

            return d.PubSub.CreateTopic(context.Background(), "order-logs")
        },
    }
}