Package postgresql witholds database specific utilities (postgres)



    This section is empty.


    View Source
    var (
    	UsersTableName  = "users_table"
    	TeamsTableName  = "teams_table"
    	GroupsTableName = "groups_table"


    func CreateTablesOrMigrateSchemas

    func CreateTablesOrMigrateSchemas(db *gorm.DB, zapLogger *zap.Logger)

      CreateTablesOrMigrateSchemas creates a given set of tables based on a schema if it does not exist or migrates the table schemas to the latest version

      func Init

      func Init(zapLogger *zap.Logger) (*gorm.DB, error)

        InitDbConnection initializes a database connection and creates associated tables/migrates schemas


        type Database

        type Database struct {
        	Engine *gorm.DB
        	Logger *zap.Logger

        func New

        func New(conn string, logger *zap.Logger) (error, *Database)

        func (*Database) CreateGroup

        func (db *Database) CreateGroup(group table.GroupORM) error

        func (*Database) CreateTeam

        func (db *Database) CreateTeam(team table.TeamORM) error

        func (*Database) CreateUser

        func (db *Database) CreateUser(user table.UserORM) error

        func (*Database) DeleteGroup

        func (db *Database) DeleteGroup(group table.GroupORM) error

        func (*Database) DeleteTeam

        func (db *Database) DeleteTeam(team table.TeamORM) error

        func (*Database) DeleteUser

        func (db *Database) DeleteUser(user table.UserORM) error

        func (*Database) GetAllGroups

        func (db *Database) GetAllGroups(limit int) (error, []*table.GroupORM)

        func (*Database) GetAllTeams

        func (db *Database) GetAllTeams(limit int) (error, []*table.TeamORM)

        func (*Database) GetAllUsers

        func (db *Database) GetAllUsers(limit int) (error, []*table.UserORM)

        func (*Database) GetGroupById

        func (db *Database) GetGroupById(id int32) (error, *table.GroupORM)

        func (*Database) GetGroupByName

        func (db *Database) GetGroupByName(groupname string) (error, *table.GroupORM)

        func (*Database) GetTeamById

        func (db *Database) GetTeamById(id int32) (error, *table.TeamORM)

        func (*Database) GetTeamByName

        func (db *Database) GetTeamByName(teamName string) (error, *table.TeamORM)

        func (Database) GetUserBasedOnParam

        func (db Database) GetUserBasedOnParam(param string, query string) (table.UserORM, error)

        func (*Database) GetUserByEmail

        func (db *Database) GetUserByEmail(email string) (error, *table.UserORM)

        func (*Database) GetUserById

        func (db *Database) GetUserById(id int32) (error, *table.UserORM)

        func (*Database) GetUserByUsername

        func (db *Database) GetUserByUsername(username string) (error, *table.UserORM)

        func (*Database) UpdateGroup

        func (db *Database) UpdateGroup(group table.GroupORM) error

        func (*Database) UpdateTeam

        func (db *Database) UpdateTeam(team table.TeamORM) error

        func (*Database) UpdateUser

        func (db *Database) UpdateUser(user table.UserORM) error

        type IDatabase

        type IDatabase interface {
        	CreateUser(User table.UserORM) error
        	UpdateUser(User table.UserORM) error
        	DeleteUser(User table.UserORM) error
        	GetUserById(id int32) (error, *table.UserORM)
        	GetUserByUsername(username string) (error, *table.UserORM)
        	GetUserByEmail(email string) (error, *table.UserORM)
        	GetAllUsers(limit int) (error, []*table.UserORM)
        	CreateGroup(group table.GroupORM) error
        	UpdateGroup(group table.GroupORM) error
        	DeleteGroup(group table.GroupORM) error
        	GetGroupById(id int32) (error, *table.GroupORM)
        	GetGroupByName(name string) (error, *table.GroupORM)
        	GetAllGroups(limit int) (error, []*table.GroupORM)
        	CreateTeam(group table.TeamORM) error
        	UpdateTeam(group table.TeamORM) error
        	DeleteTeam(group table.TeamORM) error
        	GetTeamById(id int32) (error, *table.TeamORM)
        	GetTeamByName(name string) (error, *table.TeamORM)
        	GetAllTeams(limit int) (error, []*table.TeamORM)